Januar 7, 2019 um 22:15 als Antwort auf: Kartenstil-Regel für Relationen von Twp piste:type=nordic? #26713
Danke für die Antwort. Das Bestätigt dann, was ich erahnt hatte. Die Loipen, die nur als Relation eingetragen sind, werden ich erstmal leider mit Hilfe eines Kartenstils anzeigen können…
As attachement a python script that adds a POI like described in my previous post (tested with an old version of the poi db, one without addresses).
Now if you want to convert a .poi file to a .osm.db file you will get a least a few difficulties:
* You need to match the OAM categories to Locus categories. Althrough it is possible to add new categories to a locus file, the icons seems not to be part of the .osm.db file. If you define new categories, they won’t have an icon in Locus and won’t be really usable.
* You need an empty file to start. I don’t how to generate one. It might be easier to empty an existing one.
* A simple script like that is too slow to add a lot of POIs.
* For the tables TagKey/TagValues you will probably want to deduplicate values that occurs several times. You might need a temporary index to do that with an acceptable speed.
I made a few more test a few months ago, but I haven’t get an usable solution and I’m not sure I will have time to continue further tests, that’s why I wanted to share, what I found until now.
I am a Locus Map user too and I like OpenAndroMaps very much, because I participate to OpenStreetMap myself and like to have recent maps to avoid collecting data, that someone else already collected.
I also like like the POI in LoMaps but their are always older than the OpenAndroMaps that’s why I had a look at the Locus-DB-format too a few month ago. Here a few things I found out.
As Cebewee wrote, it is not just a sqlite format but a spatialite format and it helps a lot to take that into consideration:
* The blob in the table Points are just coordinates. Using spatialite it is easy to read or write them.
* It you edit the file (on the command lind with sqlite3 or with a GUI tool like SpatialiteStudio) don’t forget to load the spatialite extension or else you will probably corrupt the file.
* The idx_* tables are geospacial indexes and the spatialite extension will take care of them automatically.
How to add a POI to an existing file?
1. Don’t forget to load the spatialite extension (select load_extension(‚mod_spatialite‘)) after opening the file.
2. For your new POI get the index of the category from FoldersRoot and the subcategory from FoldersSub.
Example: „food_drink“ / „drinking_water“ = 9 / 52
3. Add your new POI to the table Points:
id = ID of the „node“ in OpenStreetMap (but you can probably use any new value)
name = name of the POI
type = P (Probably when it is a „node“ in OpenStreetMap. It might be something else for a „way“)
geom = coordinates of the point
4. Add a record to Points_Root_Sub to set the category and subcategory of your new POI:
Points_id = Index of the POI in the table Points (Caution: it is the index, not the ID!)
FoldersRoot_id = 9
FoldersSub_id = 52
A POI can have more properties than a name and some coordinates. They can be added in the Table Points_Key_Value.