diff --git a/dhis-2/dhis-services/dhis-service-reporting/pom.xml b/dhis-2/dhis-services/dhis-service-reporting/pom.xml
index 66be700c0567..26091d8c2cab 100644
--- a/dhis-2/dhis-services/dhis-service-reporting/pom.xml
+++ b/dhis-2/dhis-services/dhis-service-reporting/pom.xml
@@ -206,7 +206,14 @@
org.locationtech.jts
jts-core
-
+
+ org.geotools
+ gt-epsg-hsql
+
+
+ org.geotools
+ gt-cql
+
org.hisp.dhis
@@ -243,6 +250,11 @@
mockito-junit-jupiter
test
+
+ org.geotools
+ gt-geojson
+ test
+
diff --git a/dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapObject.java b/dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapObject.java
index 2f769a38b97c..62008824bb10 100644
--- a/dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapObject.java
+++ b/dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/InternalMapObject.java
@@ -171,7 +171,7 @@ public SimpleFeatureType getFeatureType() {
}
try {
- return DataUtilities.createType(GEOMETRIES, "geometry:" + type + ":srid=3785");
+ return DataUtilities.createType(GEOMETRIES, "geometry:" + type + ":srid=3857");
} catch (SchemaException ex) {
throw new RuntimeException("failed to create geometry", ex);
}
diff --git a/dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapObjectTest.java b/dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapObjectTest.java
index 208e15f574f3..71169f368fec 100644
--- a/dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapObjectTest.java
+++ b/dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/mapgeneration/GeoToolsMapObjectTest.java
@@ -27,11 +27,16 @@
*/
package org.hisp.dhis.mapgeneration;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.awt.Color;
+import java.io.IOException;
+import org.geotools.geojson.geom.GeometryJSON;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.locationtech.jts.geom.Geometry;
/**
* @author Kenneth Solbø Andersen
@@ -39,6 +44,11 @@
class GeoToolsMapObjectTest {
private InternalMapObject geoToolsMapObject;
+ private GeometryJSON geometryJSON = new GeometryJSON();
+ private String multiPolygonCoordinates =
+ "[[[[11.11,22.22],[33.33,44.44],[55.55,66.66],[11.11,22.22]]],"
+ + "[[[77.77,88.88],[99.99,11.11],[22.22,33.33],[77.77,88.88]]],"
+ + "[[[44.44,55.55],[66.66,77.77],[88.88,99.99],[44.44,55.55]]]]";
@BeforeEach
void before() {
@@ -92,4 +102,16 @@ void testSetGetStrokeColor() {
geoToolsMapObject.setStrokeColor(Color.WHITE);
assertEquals(Color.WHITE, geoToolsMapObject.getStrokeColor());
}
+
+ @Test
+ void testCreateFeatureType() throws IOException {
+ Geometry geometry =
+ geometryJSON.read(
+ "{\"type\":\"MultiPolygon\", \"coordinates\":" + multiPolygonCoordinates + "}");
+ geoToolsMapObject.setGeometry(geometry);
+ assertDoesNotThrow(
+ () -> {
+ assertNotNull(MapUtils.createFeatureLayerFromMapObject(geoToolsMapObject));
+ });
+ }
}
diff --git a/dhis-2/pom.xml b/dhis-2/pom.xml
index 79f683621a8c..315ae180be7e 100644
--- a/dhis-2/pom.xml
+++ b/dhis-2/pom.xml
@@ -1355,6 +1355,16 @@
gt-referencing
${geotools.version}
+
+ org.geotools
+ gt-epsg-hsql
+ ${geotools.version}
+
+
+ org.geotools
+ gt-cql
+ ${geotools.version}
+
@@ -2003,6 +2013,9 @@ jasperreports.version=${jasperreports.version}
true
org.projectlombok:lombok
+ org.geotools:gt-main
+ org.geotools:gt-epsg-hsql
+ org.geotools:gt-cql
org.junit.jupiter:junit-jupiter
org.springframework.security:spring-security-core
net.sf.jasperreports:jasperreports