Search in sources :

Example 26 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldWorkWithNormalGPSCoordinatesAndHeight.

@Test
void shouldWorkWithNormalGPSCoordinatesAndHeight() {
    Envelope envelope = new Envelope(new double[] { -180, -90, 0 }, new double[] { 180, 90, 10000 });
    HilbertSpaceFillingCurve3D curve = new HilbertSpaceFillingCurve3D(envelope);
    assertAtLevel(curve, envelope);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 27 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldCreateSimple2DZOrderCurveAtManyLevels.

@Test
void shouldCreateSimple2DZOrderCurveAtManyLevels() {
    Envelope envelope = new Envelope(new double[] { -8, -8 }, new double[] { 8, 8 });
    for (int level = 1; level <= ZOrderSpaceFillingCurve2D.MAX_LEVEL; level++) {
        ZOrderSpaceFillingCurve2D curve = new ZOrderSpaceFillingCurve2D(envelope, level);
        assertAtLevel(curve, envelope);
        assertRange((int) curve.getWidth(), 0, curve, 0, (int) curve.getWidth() - 1);
        assertRange((int) curve.getWidth(), curve.getValueWidth() - 1, curve, (int) curve.getWidth() - 1, 0);
    }
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 28 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldGet2DHilbertSearchTilesForCenterRangeAndTraverseToBottom.

@Test
void shouldGet2DHilbertSearchTilesForCenterRangeAndTraverseToBottom() {
    TraverseToBottomConfiguration configuration = new TraverseToBottomConfiguration();
    Envelope envelope = new Envelope(-8, 8, -8, 8);
    for (// 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
    int level = 2; // 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
    level <= 11; // 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
    level++) {
        HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope, level);
        double fullTile = curve.getTileWidth(0, level);
        double halfTile = fullTile / 2.0;
        Envelope centerWithoutOuterRing = new Envelope(envelope.getMin(0) + fullTile + halfTile, envelope.getMax(0) - fullTile - halfTile, envelope.getMin(1) + fullTile + halfTile, envelope.getMax(1) - fullTile - halfTile);
        List<SpaceFillingCurve.LongRange> result = curve.getTilesIntersectingEnvelope(centerWithoutOuterRing, configuration, null);
        assertTiles(result, tilesNotTouchingOuterRing(curve).toArray(new SpaceFillingCurve.LongRange[0]));
    }
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 29 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldGiveRangesWithinMaxValuesWhenMatchingWholeEnvelopeAtMaxLevel.

@Test
void shouldGiveRangesWithinMaxValuesWhenMatchingWholeEnvelopeAtMaxLevel() {
    Envelope envelope = new Envelope(-8, 8, -8, 8);
    HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope);
    List<SpaceFillingCurve.LongRange> ranges = curve.getTilesIntersectingEnvelope(envelope);
    assertThat(ranges.size()).isEqualTo(1);
    assertThat(ranges.get(0).max).isLessThan(Long.MAX_VALUE);
    assertThat(ranges.get(0).min).isGreaterThan(Long.MIN_VALUE);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 30 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldWorkWithNormalGPSCoordinatesHilbert.

@Test
void shouldWorkWithNormalGPSCoordinatesHilbert() {
    Envelope envelope = new Envelope(-180, 180, -90, 90);
    HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope);
    assertAtLevel(curve, envelope);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Aggregations

Envelope (org.neo4j.gis.spatial.index.Envelope)55 Test (org.junit.jupiter.api.Test)48 Config (org.neo4j.configuration.Config)1 SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)1