Search in sources :

Example 1 with LatitudeDefinition

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());
}
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 LatitudeDefinition

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());
}
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 LatitudeDefinition

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());
}
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 LatitudeDefinition

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);
}
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 LatitudeDefinition

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);
}
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

LatitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LatitudeDefinition)10 LongitudeDefinition (org.locationtech.geowave.core.geotime.index.dimension.LongitudeDefinition)10 Test (org.junit.Test)8 SFCDimensionDefinition (org.locationtech.geowave.core.index.sfc.SFCDimensionDefinition)7 SpaceFillingCurve (org.locationtech.geowave.core.index.sfc.SpaceFillingCurve)7 BasicNumericDataset (org.locationtech.geowave.core.index.numeric.BasicNumericDataset)4 NumericRange (org.locationtech.geowave.core.index.numeric.NumericRange)4 MultiDimensionalNumericData (org.locationtech.geowave.core.index.numeric.MultiDimensionalNumericData)3 InsertionIds (org.locationtech.geowave.core.index.InsertionIds)2 NumericIndexStrategy (org.locationtech.geowave.core.index.NumericIndexStrategy)2 NumericData (org.locationtech.geowave.core.index.numeric.NumericData)2 RangeDecomposition (org.locationtech.geowave.core.index.sfc.RangeDecomposition)2 Point (java.awt.Point)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 HashSet (java.util.HashSet)1 ReferencedEnvelope (org.geotools.geometry.jts.ReferencedEnvelope)1 CustomCRSSpatialDimension (org.locationtech.geowave.core.geotime.store.dimension.CustomCRSSpatialDimension)1 ByteArrayRange (org.locationtech.geowave.core.index.ByteArrayRange)1 QueryRanges (org.locationtech.geowave.core.index.QueryRanges)1