Subscribe to this thread
Home - General / All posts - JSON export and import - odd results
Graeme

927 post(s)
#29-Aug-18 06:41

Had an enquiry wanting area data in JSON format.

Using area data maintained in 8, in lat/long coord system and imported into 9, I added a column "JSON" nvarchar. Transformed using "Compose GeoJSON" . Opened the drawing and invoked "Export/GEOJSON" as type, but it generated a Manifold "Critical Error" see screenshot. I copied and pasted just four area objects but again the export failed.

There are a lot of data columns. I reduced them to just 4 (Data 1..4) plus essential identifier columns. Now the export works. Saved that cut down project as an mxb - uploaded. However if I create a new project and now import the previously exported "Sample Drawing.geojson", nothing imports - no errors, nothing.

The results of firsttube's M8 script in this post does not import either. I don't see anything obvious on the documentation page, but suspect it's user error of some sort - still only dallying with 9.

Cutting Edge 9.168.1

Attachments:
Export GEOJSON error.PNG
Sample Drawing.geojson
Sample Export JSON 9.mxb

Dimitri


4,980 post(s)
#29-Aug-18 07:34

Sounds like it is worth a Bug report.

I opened your attached .mxb, opened the drawing, chose File - Export to geojson, pressed Export and it worked OK. But importing the resultant .geojson did not create a drawing.

Sloots

429 post(s)
#29-Aug-18 08:07

It is the JSON column that causes the problems. The JSON data as a property of the JSON file is invalid syntax. Perhaps some escaping is needed here by M9.


http://www.mppng.nl/manifold/pointlabeler

yves61
141 post(s)
#30-Aug-18 07:24

Graeme, I copied your Sample Drawing.geojson into a json viewer online .

This results in the following parse error message :

Message

E2 ->Error: Parse error on line 1: Parse error on line ^ Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

Graeme

927 post(s)
#30-Aug-18 07:36

Thanks yves61 - crossed posts. My failure to grasp the "EPSG" thing, got it working now I believe. See notes in "update" post below.

Graeme

927 post(s)
#30-Aug-18 07:33

Update. It was operator error re. my initial comment regarding failure to import the results of firsttube's M8 script into M9. Unfamiliar with EPSG and had a stab that Lat/Long may be just the default and thus blank. I now have learned the EPSG code for lat/long is the one in the script 4326. With that added the result imports directly and also links fine in 9 although as read only (no index). Still no joy exporting a drawing with hundreds of data columns as geojson. A trimmed down version does t, but the results will not import back into 9.

For anyone needing this in future, the example in documentation illustrating the EPSG format and syntax specifics required when adding a JSON column for subsequent export, are in the Transform Templates - Text topic.

Graeme

927 post(s)
#31-Aug-18 03:18

Interstingly, I saved two separate M9 projects exploring the export to geojson, plus an mxb version of one uploaded to the first post. None of them will open again, giving a Manifold error "Cannot load data".

Graeme

927 post(s)
#31-Aug-18 03:50

Went away for half an hour, tried again and the local ones now open fine. Go figure. I'd normally use the cutting edge build, I may have opened the actual 9 program which is still the 167 build.

Manifold User Community Use Agreement Copyright (C) 2007-2017 Manifold Software Limited. All rights reserved.