X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=environment%2Forg.argeo.geo.ui%2Fsrc%2Forg%2Fargeo%2Fgeo%2FGeoJsonUtils.java;fp=environment%2Forg.argeo.geo.ui%2Fsrc%2Forg%2Fargeo%2Fgeo%2FGeoJsonUtils.java;h=0d584802938f74fc431148a8d9cf352ecea5e1d9;hp=0000000000000000000000000000000000000000;hb=0acd3bbf62b49bfcc9329d0e77a85107ec97d6df;hpb=d3a20494b99046cd9f67491064333ba56fbe5772 diff --git a/environment/org.argeo.geo.ui/src/org/argeo/geo/GeoJsonUtils.java b/environment/org.argeo.geo.ui/src/org/argeo/geo/GeoJsonUtils.java new file mode 100644 index 0000000..0d58480 --- /dev/null +++ b/environment/org.argeo.geo.ui/src/org/argeo/geo/GeoJsonUtils.java @@ -0,0 +1,24 @@ +package org.argeo.geo; + +import java.util.Map; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** Geo data utilities. */ +public class GeoJsonUtils { + + /** Add these properties to all features. */ + public static void addProperties(JsonNode tree, Map map) { + for (JsonNode feature : tree.get("features")) { + ObjectNode properties = (ObjectNode) feature.get("properties"); + for (String key : map.keySet()) { + properties.put(key, map.get(key)); + } + } + } + + /** Singleton. */ + private GeoJsonUtils() { + } +}