Store map.features in tinydb

I store map.features to a tinydb when a leave the screen.
When i initialize it, i recover it from tinydb, trying to recover all map features (waypoints, line, circle…) but the value returned is empty.
Is it posible to save map.features elements to tinydb?


How are you attempting to save features to the TinyDB?

Did you set StoreListsAsJSON on the Screen1 Properties (by checking the box). You must do that.

This stores a polygon with a description of [[10.22054,-83.59250],[10.22088,-83.59176],[10.22054,-83.59156],[10.22019,-83.59232],[10.22054,-83.59250]] on a Map

will reproduce this

To store other features, you will need to do something similar.

Be aware, you must have a Polygon1 component on your Map. Although the component can ‘create’ Markers (run time markers) on the fly, it cannot create other objects. (It might work using FeatureCollection json files provided there is a FeatureCollection component on the screen…sorry I haven’t tried that).

What are you trying that fails Patricio? Show your blocks or an aia?


Let me explain a bit more.
In my app, the user create some waypoints in the map. The app draw automatically other thigns (lines, circle…).
When i leave the screen, and enter again, i loose all those features, so i would like to store all of them, and recover them each time i re-open the screen.
For this i tried these 2 options, but it didn’t work.


None of those work for various reasons.

This scheme to save does work for a Trak (in this case, to display a LineString with four points (that describe a rectangle).

The JSON coordinates for the Trak are: [[10.22054,-83.59250],[10.22088,-83.59176],[10.22054,-83.59156],[10.22019,-83.59232],[10.22054,-83.59250]]

The code saves a LineString route (or Trak) as a LineString in a TinyDB Tag called trak1. When you run this code, you must set


The code:

First, the Trak must be created. Button1.
Then it must be save as a Tag called trak1 using the code in Button2

Then, and only then can it be retrieved using the code in Button3.

To confirm that the trak1 is saved; close the app. Run the program again but do not use Button’s 1 and 2. Use Button3. Do you see the rectangle drawn on the Map?

Can this stuff be saved other ways? Perhaps. This technique saves a Trak in a TinyDB. It is the simplest way I am aware of. My previous post shows how to save and re-display a polygon. Similar code will allow saving of other Map features.

Did you try the code? What happened?


Hi Steve.
You post will be helpfull with other screen, which will record the track done by the user. Great!
I have another question related to this project, about how to work with markers created in runtime using “Call map1.createmarker”…

If i want to, for example, delete any marker that has a specific Title… how to do it?
Or if a want to modify the description of a specific marker, without selecting it from the map, but searching the marker by the title it has… how to do it?



Possibly discussed in How to display Map runtime Markers, calculate distances, determine closest or in this App Inventor GPS Trak Basics. …and Remove Runtime Markers from a Map

If this is not what you need to do there is additional advice somewhere in this List of Topics . You will probably find what you are looking for Patricio. If you don’t find an answer, try the older AI2 Forum, in this List.

Good night
– Steve

Hi Steve.
“Remove Runtime Markers from a Map” has been quite interesting to read.
I will also read the other links.
Thanks so much for you time!