Hi Devs,
I am attempting to directly update the coordinates using the WebAPI, but am running into issues with the formatting (I think) of JSON fragments.
The worflow is as follows.
-
Use MapShaper to simplify the coordinates.
-
Export as GeoJSON.
-
Use curl to PUT the coordinates to the correct end point, e.g. http://myserver/api/organisationUnits/abcd1234/coordinates
-
Use curl to PUT the feature type (either “POLYGON” or “MULTI_POLYGON”) depending on what is reported by the GeoJSON.
That part seems to work fine and I get something which looks like this.
Sample polygon…
{
-
featureType: “POLYGON”,
-
coordinates: "[[[[125.8054,-8.7452],[125.8038,-8.7455],[125.8031,-8.7455],[125.8031,-8.7471],[125.8028,-8.748],[125.8021,-8.7488],[125.8013,-8.7492],[125.8004,-8.7494],
Sample MultiPolygon:
{
-
featureType: “MULTI_POLYGON”,
-
coordinates: "[[[[[127.3286,-8.448],[127.3281,-8.4479],[127.3272,-8.4476],[127.3271,-8.4473],[127.3267,-8.447],[127.3254,-8.4473],[127.3251,-8.4471],[127.3249,-8.4466],[127.3246,-8.4465]…
In the GIS client, when loading any of the MultiPolygon’s I get
Uncaught TypeError: Cannot read property ‘length’ of null with util.map.getTransformedFeatureArray.
If I mangle the GeoJSON such that is has four square brackets (instead of five as above) things works OK. If I change the number of square brackets of normal polygons to three (as in the spec example here) , I get the same error.
Is there a particular reason for this? It would seem to be desirable to allow the upload of GeoJSON directly from a GIS system, without having to mangle it before.
Regards,
Jason
···
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049