From: Mathieu Baudier Date: Mon, 12 Jul 2021 06:39:11 +0000 (+0200) Subject: Introduce GeoJsonUtils. X-Git-Tag: argeo-suite-2.3.1~28 X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=commitdiff_plain;h=0acd3bbf62b49bfcc9329d0e77a85107ec97d6df Introduce GeoJsonUtils. --- 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() { + } +}