1

I need to embed a map from DHIS2 onto a web page. Dissecting the example @ https://play.dhis2.org/dem. I get to the map from its API link https://play.dhis2.org/demo/api/26/maps/ytkZY3ChM6J/data. But when I try the same in the local instance I get;

{"httpStatus":"Internal Server Error","httpStatusCode":500,"status":"ERROR","message":"holes must not contain null elements"}

Below is the stack trace from tomcat7-stderr.log. I would be grateful if someone can give a pointer to what I am doing wrong.

java.lang.IllegalArgumentException: holes must not contain null elements
    at com.vividsolutions.jts.geom.Polygon.<init>(Polygon.java:143)
    at com.vividsolutions.jts.geom.GeometryFactory.createPolygon(GeometryFactory.java:405)
    at org.hisp.dhis.mapgeneration.GeoToolsPrimitiveFromJsonFactory.createPolygonFromJson(GeoToolsPrimitiveFromJsonFactory.java:137)
    at org.hisp.dhis.mapgeneration.GeoToolsPrimitiveFromJsonFactory.createMultiPolygonFromJson(GeoToolsPrimitiveFromJsonFactory.java:94)
    at org.hisp.dhis.mapgeneration.InternalMapObject.buildGeometryForOrganisationUnit(InternalMapObject.java:176)
    at org.hisp.dhis.mapgeneration.InternalMapLayer.addDataMapObject(InternalMapLayer.java:184)
    at org.hisp.dhis.mapgeneration.GeoToolsMapGenerationService.getSingleInternalMapLayer(GeoToolsMapGenerationService.java:284)
    at org.hisp.dhis.mapgeneration.GeoToolsMapGenerationService.generateMapImageForUser(GeoToolsMapGenerationService.java:140)
    at org.hisp.dhis.mapgeneration.GeoToolsMapGenerationService.generateMapImage(GeoToolsMapGenerationService.java:119)
    at org.hisp.dhis.webapi.controller.mapping.MapController.renderMapViewPng(MapController.java:292)
    at org.hisp.dhis.webapi.controller.mapping.MapController.getMapData(MapController.java:209)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

1 Answer 1

1

This indicates that there is a problem with the coordinates representing a polygon associated with an organisation unit in your map. As the message indicates, there is a problem with the representation of a hole in the polygon.

To inspect your coordinate information you can export it in the raw DHIS 2 format:

/api/organisationUnits.json?fields=id,name,coordinates&level2

or as GeoJSON:

/api/organisationUnits.geojson?level=2

and then use a validator to identify the organisation unit with the invalid coordinates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.