Search in sources :

Example 1 with SFCDimensionDefinition

use of org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition 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 SFCDimensionDefinition

use of org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition 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 SFCDimensionDefinition

use of org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition 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 SFCDimensionDefinition

use of org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition 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 SFCDimensionDefinition

use of org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition 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

SFCDimensionDefinition (org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition)22 SpaceFillingCurve (org.locationtech.geowave.core.index.sfc.SpaceFillingCurve)11 Test (org.junit.Test)8 LatitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition)7 LongitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition)7 ArrayList (java.util.ArrayList)6 ImmutableBiMap (com.google.common.collect.ImmutableBiMap)3 CompactHilbertCurve (com.google.uzaygezen.core.CompactHilbertCurve)3 MultiDimensionalSpec (com.google.uzaygezen.core.MultiDimensionalSpec)3 ByteBuffer (java.nio.ByteBuffer)3 BasicNumericDataset (org.locationtech.geowave.core.index.numeric.BasicNumericDataset)3 NumericRange (org.locationtech.geowave.core.index.numeric.NumericRange)3 RangeDecomposition (org.locationtech.geowave.core.index.sfc.RangeDecomposition)3 PrimitiveHilbertSFCOperations (org.locationtech.geowave.core.index.sfc.hilbert.PrimitiveHilbertSFCOperations)2 UnboundedHilbertSFCOperations (org.locationtech.geowave.core.index.sfc.hilbert.UnboundedHilbertSFCOperations)2 BigInteger (java.math.BigInteger)1 BasicDimensionDefinition (org.locationtech.geowave.core.index.dimension.BasicDimensionDefinition)1 MultiDimensionalNumericData (org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData)1 NumericData (org.locationtech.geowave.core.index.numeric.NumericData)1