use of org.opengis.feature.simple.SimpleFeature in project dhis2-core by dhis2.
the class MapUtils method createFeatureLayerFromMapObject.
/**
* Creates a feature layer based on a map object.
*/
public static Layer createFeatureLayerFromMapObject(InternalMapObject mapObject) {
Style style = mapObject.getStyle();
SimpleFeatureType featureType = mapObject.getFeatureType();
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
featureBuilder.add(mapObject.getGeometry());
SimpleFeature feature = featureBuilder.buildFeature(null);
featureCollection.add(feature);
return new FeatureLayer(featureCollection, style);
}
Aggregations