use of eu.europa.ec.fisheries.uvms.commons.geometry.mapper.FeatureToGeoJsonJacksonMapper in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingTripToGeoJsonMapper method toJson.
// Convert Geometry list into GEO JSON format
public static ObjectNode toJson(List<Geometry> geoList) {
ObjectNode rootNode = null;
DefaultFeatureCollection trips = new DefaultFeatureCollection(null, build());
for (Geometry geo : geoList) {
SimpleFeature feature = toFeature(geo);
trips.add(feature);
}
try {
rootNode = new FeatureToGeoJsonJacksonMapper().convert(trips);
} catch (IOException e) {
log.error("Error while trying to convert fishing trips to Geo JSON", e);
}
return rootNode;
}
Aggregations