use of org.n52.io.crs.CRSUtils in project series-rest-api by 52North.
the class IoParameters method parseBoundsFromVicinity.
private BoundingBox parseBoundsFromVicinity() {
if (!containsParameter(NEAR)) {
return null;
}
String nearValue = getAsString(NEAR);
CRSUtils crsUtils = CRSUtils.createEpsgForcedXYAxisOrder();
Vicinity vicinity = null;
if (bboxMatching(nearValue, 2)) {
String[] coordArray = nearValue.split(SPLIT_REGEX);
Point point = crsUtils.createPoint(Double.valueOf(coordArray[0].trim()), Double.valueOf(coordArray[1].trim()), CRSUtils.DEFAULT_CRS);
vicinity = new Vicinity(point, Double.valueOf(coordArray[2].trim()));
} else {
vicinity = handleJsonValueParseException(NEAR, Vicinity.class, this::parseJson);
}
if (containsParameter(CRS)) {
vicinity.setCenter(convertToCrs84(vicinity.getCenter()));
}
BoundingBox bounds = vicinity.calculateBounds();
LOGGER.debug("Parsed vicinity bounds: {}", bounds.toString());
return bounds;
}
Aggregations