Search in sources :

Example 1 with SpaceFillingCurve

use of org.locationtech.geowave.core.index.sfc.SpaceFillingCurve in project geowave by locationtech.

the class HilbertSFCTest method testGetId_2DSpatialMaxValue.

@Test
public void testGetId_2DSpatialMaxValue() throws Exception {
    final int LATITUDE_BITS = 31;
    final int LONGITUDE_BITS = 31;
    final Double[] testValues = new Double[] { 90d, 180d };
    final long expectedID = 3074457345618258602L;
    final SFCDimensionDefinition[] SPATIAL_DIMENSIONS = new SFCDimensionDefinition[] { new SFCDimensionDefinition(new LatitudeDefinition(), LATITUDE_BITS), new SFCDimensionDefinition(new LongitudeDefinition(), LONGITUDE_BITS) };
    final SpaceFillingCurve hilbertSFC = SFCFactory.createSpaceFillingCurve(SPATIAL_DIMENSIONS, SFCType.HILBERT);
    Assert.assertEquals(expectedID, ByteBuffer.wrap(hilbertSFC.getId(testValues)).getLong());
}
Also used : LatitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition) SFCDimensionDefinition(org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition) SpaceFillingCurve(org.locationtech.geowave.core.index.sfc.SpaceFillingCurve) LongitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition) Test(org.junit.Test)

Example 2 with SpaceFillingCurve

use of org.locationtech.geowave.core.index.sfc.SpaceFillingCurve in project geowave by locationtech.

the class HilbertSFCTest method testGetId_2DSpatialMinValue.

@Test
public void testGetId_2DSpatialMinValue() throws Exception {
    final int LATITUDE_BITS = 31;
    final int LONGITUDE_BITS = 31;
    final Double[] testValues = new Double[] { -90d, -180d };
    final long expectedID = 0L;
    final SFCDimensionDefinition[] SPATIAL_DIMENSIONS = new SFCDimensionDefinition[] { new SFCDimensionDefinition(new LatitudeDefinition(), LATITUDE_BITS), new SFCDimensionDefinition(new LongitudeDefinition(), LONGITUDE_BITS) };
    final SpaceFillingCurve hilbertSFC = SFCFactory.createSpaceFillingCurve(SPATIAL_DIMENSIONS, SFCType.HILBERT);
    Assert.assertEquals(expectedID, ByteBuffer.wrap(hilbertSFC.getId(testValues)).getLong());
}
Also used : LatitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition) SFCDimensionDefinition(org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition) SpaceFillingCurve(org.locationtech.geowave.core.index.sfc.SpaceFillingCurve) LongitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition) Test(org.junit.Test)

Example 3 with SpaceFillingCurve

use of org.locationtech.geowave.core.index.sfc.SpaceFillingCurve in project geowave by locationtech.

the class HilbertSFCTest method testGetId_2DSpatialIllegalArgument.

// @Test(expected = IllegalArgumentException.class)
public void testGetId_2DSpatialIllegalArgument() throws Exception {
    final int LATITUDE_BITS = 31;
    final int LONGITUDE_BITS = 31;
    final Double[] testValues = new Double[] { -100d, -180d };
    final long expectedID = 0L;
    final SFCDimensionDefinition[] SPATIAL_DIMENSIONS = new SFCDimensionDefinition[] { new SFCDimensionDefinition(new LatitudeDefinition(), LATITUDE_BITS), new SFCDimensionDefinition(new LongitudeDefinition(), LONGITUDE_BITS) };
    final SpaceFillingCurve hilbertSFC = SFCFactory.createSpaceFillingCurve(SPATIAL_DIMENSIONS, SFCType.HILBERT);
    Assert.assertEquals(expectedID, ByteBuffer.wrap(hilbertSFC.getId(testValues)).getLong());
}
Also used : LatitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition) SFCDimensionDefinition(org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition) SpaceFillingCurve(org.locationtech.geowave.core.index.sfc.SpaceFillingCurve) LongitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition)

Example 4 with SpaceFillingCurve

use of org.locationtech.geowave.core.index.sfc.SpaceFillingCurve in project geowave by locationtech.

the class HilbertSFCTest method testDecomposeQuery_2DSpatialOneIndexFilter.

@Test
public void testDecomposeQuery_2DSpatialOneIndexFilter() {
    final int LATITUDE_BITS = 31;
    final int LONGITUDE_BITS = 31;
    final SFCDimensionDefinition[] SPATIAL_DIMENSIONS = new SFCDimensionDefinition[] { new SFCDimensionDefinition(new LongitudeDefinition(), LONGITUDE_BITS), new SFCDimensionDefinition(new LatitudeDefinition(), LATITUDE_BITS) };
    final SpaceFillingCurve hilbertSFC = SFCFactory.createSpaceFillingCurve(SPATIAL_DIMENSIONS, SFCType.HILBERT);
    // Create a IndexRange object using the x axis
    final NumericRange rangeX = new NumericRange(55, 57);
    // Create a IndexRange object using the y axis
    final NumericRange rangeY = new NumericRange(25, 27);
    final BasicNumericDataset spatialQuery = new BasicNumericDataset(new NumericData[] { rangeX, rangeY });
    final RangeDecomposition rangeDecomposition = hilbertSFC.decomposeRange(spatialQuery, true, 1);
    Assert.assertEquals(1, rangeDecomposition.getRanges().length);
}
Also used : NumericRange(org.locationtech.geowave.core.index.numeric.NumericRange) LatitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition) BasicNumericDataset(org.locationtech.geowave.core.index.numeric.BasicNumericDataset) SFCDimensionDefinition(org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition) SpaceFillingCurve(org.locationtech.geowave.core.index.sfc.SpaceFillingCurve) RangeDecomposition(org.locationtech.geowave.core.index.sfc.RangeDecomposition) LongitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition) Test(org.junit.Test)

Example 5 with SpaceFillingCurve

use of org.locationtech.geowave.core.index.sfc.SpaceFillingCurve in project geowave by locationtech.

the class HilbertSFCTest method testDecomposeQuery_2DSpatialTwentyIndexFilters.

@Test
public void testDecomposeQuery_2DSpatialTwentyIndexFilters() {
    final int LATITUDE_BITS = 31;
    final int LONGITUDE_BITS = 31;
    final SFCDimensionDefinition[] SPATIAL_DIMENSIONS = new SFCDimensionDefinition[] { new SFCDimensionDefinition(new LongitudeDefinition(), LONGITUDE_BITS), new SFCDimensionDefinition(new LatitudeDefinition(), LATITUDE_BITS) };
    final SpaceFillingCurve hilbertSFC = SFCFactory.createSpaceFillingCurve(SPATIAL_DIMENSIONS, SFCType.HILBERT);
    // Create a IndexRange object using the x axis
    final NumericRange rangeX = new NumericRange(10, 57);
    // Create a IndexRange object using the y axis
    final NumericRange rangeY = new NumericRange(25, 50);
    final BasicNumericDataset spatialQuery = new BasicNumericDataset(new NumericData[] { rangeX, rangeY });
    final RangeDecomposition rangeDecomposition = hilbertSFC.decomposeRange(spatialQuery, true, 20);
    Assert.assertEquals(20, rangeDecomposition.getRanges().length);
}
Also used : NumericRange(org.locationtech.geowave.core.index.numeric.NumericRange) LatitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition) BasicNumericDataset(org.locationtech.geowave.core.index.numeric.BasicNumericDataset) SFCDimensionDefinition(org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition) SpaceFillingCurve(org.locationtech.geowave.core.index.sfc.SpaceFillingCurve) RangeDecomposition(org.locationtech.geowave.core.index.sfc.RangeDecomposition) LongitudeDefinition(org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition) Test(org.junit.Test)

Aggregations

SpaceFillingCurve (org.locationtech.geowave.core.index.sfc.SpaceFillingCurve)15 SFCDimensionDefinition (org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition)11 LatitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition)7 LongitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition)7 Test (org.junit.Test)6 ImmutableBiMap (com.google.common.collect.ImmutableBiMap)3 ArrayList (java.util.ArrayList)2 BasicNumericDataset (org.locationtech.geowave.core.index.numeric.BasicNumericDataset)2 NumericRange (org.locationtech.geowave.core.index.numeric.NumericRange)2 RangeDecomposition (org.locationtech.geowave.core.index.sfc.RangeDecomposition)2 BigInteger (java.math.BigInteger)1 ByteBuffer (java.nio.ByteBuffer)1 QueryRanges (org.locationtech.geowave.core.index.QueryRanges)1 SinglePartitionInsertionIds (org.locationtech.geowave.core.index.SinglePartitionInsertionIds)1 SinglePartitionQueryRanges (org.locationtech.geowave.core.index.SinglePartitionQueryRanges)1 NumericDimensionDefinition (org.locationtech.geowave.core.index.dimension.NumericDimensionDefinition)1 BinnedNumericDataset (org.locationtech.geowave.core.index.numeric.BinnedNumericDataset)1