Search in sources :

Example 6 with BoundingBox

use of org.n52.io.crs.BoundingBox in project series-rest-api by 52North.

the class VicinityTest method shouldHaveCommonLatitudeCircleWhenCenterIsNorthPole.

@Test
public void shouldHaveCommonLatitudeCircleWhenCenterIsNorthPole() {
    Vicinity vicinity = createRadiusAtNorthPole(circleAroundNorthPole);
    BoundingBox bounds = vicinity.calculateBounds();
    double llLatitudeOfSmallCircle = bounds.getLowerLeft().getY();
    double urLatitudeOfSmallCircle = bounds.getUpperRight().getY();
    assertThat(llLatitudeOfSmallCircle, closeTo(urLatitudeOfSmallCircle, ERROR_DELTA));
}
Also used : BoundingBox(org.n52.io.crs.BoundingBox) Test(org.junit.Test)

Example 7 with BoundingBox

use of org.n52.io.crs.BoundingBox in project series-rest-api by 52North.

the class VicinityTest method shouldHaveInversedLatitudesWhenCenterIsOnEquator.

@Test
public void shouldHaveInversedLatitudesWhenCenterIsOnEquator() {
    Vicinity vicinity = createRadiusAtNorthPole(circleCenterAtGreenwhichAndEquator);
    BoundingBox bounds = vicinity.calculateBounds();
    double llLatitudeOfSmallCircle = bounds.getLowerLeft().getY();
    double urLatitudeOfSmallCircle = bounds.getUpperRight().getY();
    assertThat(llLatitudeOfSmallCircle, closeTo(-urLatitudeOfSmallCircle, ERROR_DELTA));
}
Also used : BoundingBox(org.n52.io.crs.BoundingBox) Test(org.junit.Test)

Example 8 with BoundingBox

use of org.n52.io.crs.BoundingBox in project series-rest-api by 52North.

the class VicinityTest method shouldHaveInversedLongitudesWhenCenterIsOnGreenwhich.

@Test
public void shouldHaveInversedLongitudesWhenCenterIsOnGreenwhich() {
    Vicinity vicinity = createRadiusAtNorthPole(circleCenterAtGreenwhichAndEquator);
    BoundingBox bounds = vicinity.calculateBounds();
    double llLongitudeOfGreatCircle = bounds.getLowerLeft().getX();
    double urLongitudeOnGreatCircle = bounds.getUpperRight().getX();
    assertThat(llLongitudeOfGreatCircle, closeTo(-urLongitudeOnGreatCircle, ERROR_DELTA));
}
Also used : BoundingBox(org.n52.io.crs.BoundingBox) Test(org.junit.Test)

Example 9 with BoundingBox

use of org.n52.io.crs.BoundingBox in project series-rest-api by 52North.

the class VicinityTest method shouldHaveCommonLatitudeCircleWhenCenterIsSouthPole.

@Test
public void shouldHaveCommonLatitudeCircleWhenCenterIsSouthPole() {
    Vicinity vicinity = createRadiusAtNorthPole(circleAroundSouthPole);
    BoundingBox bounds = vicinity.calculateBounds();
    double llLatitudeOfSmallCircle = bounds.getLowerLeft().getY();
    double urLatitudeOfSmallCircle = bounds.getUpperRight().getY();
    assertThat(llLatitudeOfSmallCircle, closeTo(urLatitudeOfSmallCircle, ERROR_DELTA));
}
Also used : BoundingBox(org.n52.io.crs.BoundingBox) Test(org.junit.Test)

Example 10 with BoundingBox

use of org.n52.io.crs.BoundingBox in project series-rest-api by 52North.

the class IoParameters method parseBoundsFromVicinity.

private BoundingBox parseBoundsFromVicinity() {
    if (!containsParameter(NEAR)) {
        return null;
    }
    String vicinityValue = getAsString(NEAR);
    Vicinity vicinity = parseJson(vicinityValue, Vicinity.class);
    if (containsParameter(CRS)) {
        vicinity.setCenter(convertToCrs84(vicinity.getCenter()));
    }
    BoundingBox bounds = vicinity.calculateBounds();
    LOGGER.debug("Parsed vicinity bounds: {}", bounds.toString());
    return bounds;
}
Also used : BoundingBox(org.n52.io.crs.BoundingBox)

Aggregations

BoundingBox (org.n52.io.crs.BoundingBox)9 Test (org.junit.Test)5 Point (com.vividsolutions.jts.geom.Point)3 GeojsonPoint (org.n52.io.geojson.old.GeojsonPoint)3 CRSUtils (org.n52.io.crs.CRSUtils)2 Geometry (com.vividsolutions.jts.geom.Geometry)1 WKTReader (com.vividsolutions.jts.io.WKTReader)1 Before (org.junit.Before)1 BBox (org.n52.io.response.BBox)1 FactoryException (org.opengis.referencing.FactoryException)1