------------------------------------------------------------
revno: 21662
committer: Jan Henrik Overland <[email protected]>
branch nick: dhis2
timestamp: Fri 2016-01-08 11:30:35 +0100
message:
  GIS polygon fix.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2016-01-05 13:43:20 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/core.js	2016-01-08 10:30:35 +0000
@@ -3168,7 +3168,7 @@
                 // sort
                 util.array.sort(organisationUnits, levelOrder, 'le');
 
-				for (var i = 0, ou, gpid = '', gppg = ''; i < organisationUnits.length; i++) {
+				for (var i = 0, ou, gpid = '', gppg = '', type; i < organisationUnits.length; i++) {
                     ou = organisationUnits[i];
 
                     // grand parent
@@ -3186,10 +3186,23 @@
                         }
                     }
 
+                    //TODO improve
+                    if (parseInt(ou.ty) === 1) {
+                        type = 'Point';
+                    }
+                    else {
+                        if (ou.co.substring(0, 4) === '[[[[') {
+                            type = 'MultiPolygon';
+                        }
+                        else {
+                            type = 'Polygon';
+                        }
+                    }
+
 					geojson.features.push({
                         type: 'Feature',
 						geometry: {
-							type: parseInt(ou.ty) === 1 ? 'Point' : 'MultiPolygon',
+							type: type,
 							coordinates: JSON.parse(ou.co)
 						},
 						properties: {

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to