Ejemplo n.º 1
0
 /**
  * @param center the lon-lat ordered center.
  * @param radius the distance around the center
  */
 public Vicinity(String[] center, String radius) {
   try {
     this.radius = parseDouble(radius);
     this.center = createCenter(GeojsonPoint.create(center));
   } catch (NumberFormatException e) {
     throw new IllegalArgumentException("Could not parse radius.");
   } catch (FactoryException e) {
     throw new IllegalArgumentException("Could not parse center.");
   }
 }
Ejemplo n.º 2
0
 /**
  * @param coordinates
  * @throws FactoryException
  * @throws IllegalArgumentException if coordinates are <code>null</code> or do not contain a two
  *     dimensional point.
  */
 public void setCenter(String[] coordinates) throws FactoryException {
   center = createCenter(GeojsonPoint.create(coordinates));
 }
Ejemplo n.º 3
0
 /**
  * @param center the center point as GeoJSON point.
  * @return the lon-lat ordered WGS84 center point.
  * @throws FactoryException if creating coordinates fails.
  */
 private Point createCenter(GeojsonPoint center) throws FactoryException {
   Double easting = new Double(center.getCoordinates()[0]);
   Double northing = parseDouble(center.getCoordinates()[1]);
   Coordinate coordinate = inputReference.createCoordinate(EPSG_4326, easting, northing);
   return geometryFactory.createPoint(coordinate);
 }