use of org.codice.ddf.spatial.geocoder.GeoCoder in project ddf by codice.
the class GeoCoderServiceImpl method getNearbyCities.
@Override
public String getNearbyCities(String wkt) throws GeoEntryQueryException {
GeoCoder geoCoder = geoCoderFactory.getService();
NearbyLocation nearbyLocation = geoCoder.getNearbyCity(wkt);
if (nearbyLocation != null) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("direction", nearbyLocation.getCardinalDirection());
jsonObject.put("distance", nearbyLocation.getDistance());
jsonObject.put("name", nearbyLocation.getName());
return jsonObject.toJSONString();
} else {
return null;
}
}
Aggregations