Hello. I'm a CS Student trying to create an app using the App inventor.
I'm trying to create a parking-lot-reservation app working with the map component and polygons representing the parking lots. I have created some Polygons in a GeoJSON-File, that are representing the Parking lots. You can see the Format in the following TXT-File: Mapa_Data_Shorted.txt (389 Bytes)
Format: 5 coordinates to draw the polygon.
I used my GeoJSON-File for a FeatureCollection in the app inventor without any problems.
After importing the Polygons, I've tried to export them again into a GeoJSON-File using the Map.Save method.
The created GeoJSON-File cannot be parsed again by the FeatureCollection: (in TXT to upload) Mapa_Data_Shorted_Export.txt (553 Bytes)
Differences in format:
I've noticed, that the coordinates-format is other than mine. There is missing the fifth coordinate (The first Point of the Polygon) of a given Polygon. In my opinion, a polygon-feature needs 5 coordinates in geojson.
I've also noticed, that my 5 coordinates are enclosed in another set of "[ ]". Meaning, in my first geojson data, I've got 2 Pairs of "[ ]" enclosing the coordinates. The exported geojson-file only got 1 Pair of "" enclosing the 4 coordinates.
There are properties, but that's allright.
I tried to parse the exported geojson-file in geojson.io and if I fix the first two mentioned differences, the geojson-file is working.
Item 1 is definitely an issue since the standard requires that the polygon be closed by having the first coordinate repeated. Internally we don't store it this way and this leaks out when we serialize to GeoJSON. Item 2 is also related to this because technically App Inventor treats each type as the "multi" version, so internally we have a multipolygon with just a single child (but you can in fact have multiple polygons just that the UI doesn't support creating them). We'll probably need to adjust the internal representation so that when we serialize we have enough metadata to know whether we have a single polygon, a multipolygon with 1 polygon, or a true multipolygon. Item 3 is expected because we serialize the properties of the component out so that if the file is read back in the markers, etc. take on the same property values.