use of org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition 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());
}
use of org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition 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());
}
use of org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition 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());
}
use of org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition 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);
}
use of org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition 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);
}
Aggregations