Hexagon Geospatial
MENU

Smart M.App

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

"failed to decode metadata" uploading geojson to M.app Chest

I'm tryint to upload a bunch of geojson files to M.App Chest, but they all fail. The error message just says ERROR, but looking with the debugger I notice an errormessage 'failed to decode metadata'.

Here's an excerpt of the geojson. I probably have a blind spot, but I don't see it.

BTW: the type: "FeatureCollection" is at the bottom, because these files are generated by PowerShell which sorts the key alphabetically. 

 

{
    "crs":  {
                "type":  "name",
                "properties":  {
                                   "name":  "urn:ogc:def:crs:OGC:1.3:CRS84"
                               }
            },
    "features":  [
                     {
                         "type":  "Feature",
                         "properties":  {
                                            "zone":  1529
                                        },
                         "geometry":  {
                                          "type":  "Polygon",
                                          "coordinates":  [
                                                              [
                                                                  [
                                                                      5.10492,
                                                                      51.76622
                                                                  ],
                                                                  [
                                                                      5.103,
                                                                      51.77421
                                                                  ],
                                                                  [
                                                                      5.11154,
                                                                      51.77464
                                                                  ],
                                                                  [
                                                                      5.11381,
                                                                      51.77765
                                                                  ],
                                                                  [
                                                                      5.11624,
                                                                      51.77883
                                                                  ],
                                                                  [
                                                                      5.12784,
                                                                      51.7751
                                                                  ],
																  
																  
[snip]
                                                                  [
                                                                      5.02363,
                                                                      51.74032
                                                                  ],
                                                                  [
                                                                      5.00805,
                                                                      51.74088
                                                                  ],
                                                                  [
                                                                      5.00268,
                                                                      51.74182
                                                                  ],
                                                                  [
                                                                      4.99707,
                                                                      51.74418
                                                                  ],
                                                                  [
                                                                      4.99563,
                                                                      51.74721
                                                                  ]
                                                              ]
                                                          ]
                                      }
                     }
                 ],
    "type":  "FeatureCollection"
}
Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

Hi,

 

What is the "[snip]" string? It makes the JSON invalid.

 

Try to validate the JSON file firstly here: http://jsonlint.com/

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

I just cut out an irrelevant part out of the file, because it was too large to post.
Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

[ Edited ]

Ok this file works fine, I just had to repair the last point from the linear string to have the polygon closed. I checked firstly the file here:

http://geojson.io/#id=gist:anonymous/b2cbf7f319e0d5bd9e08ba40592f8513&map=13/51.7596/5.0625

 

And it also works in M.App Chest:

Untitled.png

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

ah, you found my blind spot. I just looked at the syntax, not the content. Apparently some viewers don't mind that the polygon isn't closed. Thank you!

Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

Hi Jan,

 

It turns out to be more complicated than that. The problem is not that the polygons don't close but the have internal intersections. I've used mapshaper.org to load and export my file and now it's accepted. Now I have to convert a few hundred geojson files somehow :-(

 

Too bad M.App Chest doesn't accept these files. Leaflet really doesn't mind and displays these files without problems

Technical Evangelist
Posts: 1,118
Registered: ‎09-11-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

Do you mean that you have self-intersecting polygon rings? That's apparently invalid polygon data and you can't blame M.App Chest for not supporting it Smiley Wink

 

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Frequent Contributor
Posts: 107
Registered: ‎10-16-2015

Re: "failed to decode metadata" uploading geojson to M.app Chest

I finally found it. Turns out that all my files were encoded in 'UCS-2 LE BOM'. Apparently PowerShell does this by default? I don't know.

 

Anyways, now that they're in UTF-8 it works just fine.

 

Sorry for bothering you.

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.