-
-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve GPX compatibility with Osmand #246
Comments
ok so offline usage does not seem to be a priority for this project wich is totally fine as it is kinda out of scope (even tough it would still be great as facilmap is by far the best mapping system I have seen). Since that is the case I wrote myself a little script to take the geojson exportable by facilmap and convert it into one .gpx file with points of interests and a folder with multiple GPX files for each track. The script is super hacky and shows my inability or at least unwillingness to properly work with XML files but it produces what its supposed to produce and works quite nice in OsmAnd. It can also pretty easily be adapted and changed to whatever needs one might have. Maybe it helps someone looking to use his facilmap offline on an android device, if not it at least did the job for me :) https://gist.github.com/vabene1111/d5520b24bf7c5a07b9ed2fa1f8cc1d4b |
Thanks for your contribution! Indeed, offline capabilities would be great, but I don't see them being feasible right now. FacilMap is just a combination of several external services, for example different map styles and routing services. All of these rely on a connection to the server, so creating offline support would essentially mean creating an entirely new app, which also feels a bit useless, as it would basically duplicate the work that Osmand has already done. But what would be interesting would be to improve the export/import capabilities to exchange data with Osmand. Since I'm not an active user of Osmand myself, I would be curious what the specific pain points are of using the GPX export that FacilMap provides? |
sure, I think that would be a great addition and also one that could be somewhat easily be incorporated into facilmap by providing an additional exporter. I think the main problems/challenges would be
I would really love to help add this in if you feel like it would be a good feature because I just love facilmap, it has made my vacation planning so much more enjoyable. For me, my biggest challenge would be the icon thing, if you know anything about that it would save me a lot of research, other than that I think I could help. After that we could write an exporter similar to https://github.com/FacilMap/facilmap/blob/main/server/src/export/gpx.ts I will be on vacation and some Business trips so I am not sure when I can get started, likely end of november/beginning of december. |
I think what would help me the most would be to investigate a little bit how exactly the GPX files would have to look to be supported by Osmand. Maybe you can export a few GPX files with different formattings in Osmand and have a look at the documentation (and this and write a little overview over how the different settings of a FacilMap marker/line would map to an Osmand GPX object. Unfortunately it's a bit hard right now to make changes to the code base because a lot of dependencies are really outdated. I'm in the process of updating a lot of the code right now but I don't have a lot of time, so I'm not sure how long this will take. I'm planning to take a few months off work in spring and hope to find the time there to work on FacilMap. If it turns out that to support Osmand we have to split up the map into one GPX file per line, I would probably replace the current 3 export buttons with a single one that opens an export dialog where the exact format of the export can be configured, so it will be a bit more work than just adapting the GPX export code. |
that sounds like a good plan. When I have time I will create a proper overview of the different attributes facilmap has and how they map to OSMAnd files, then if you have time you can implement it and I will improve my script if I find anything that can be added there for the meantime. |
Ok so i did not want to forget everything while on vacation so I wrote everything down that I found so far (see the next comment which we can update as we go). If you could point me to the place where I can find the list of all icons FacilMap supports or the function that generates said list I could start to look into how icon mapping could work. |
OsmAnd GPXSee also OsmAnd Docs PointsSchema
The <gpx version="1.1"
creator="OsmAndRouterV2"
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osmand="https://osmand.net"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
<wpt>
<name>Name</name>
<extensions>
...
</extensions>
</wpt>
<wpt>
<name>...</name>
<extensions>
...
</extensions>
</wpt>
...
</gpx> ColorColor is simply an extension attribute as shown below. <gpx>
<wpt>
...
<extensions>
<osmand:colour>#38fff8</osmand:colour>
...
</extensions>
</wpt>
</gpx> SizeThere does not seem to be an option to control the size of a marker.
IconOsmAnd supports lots of icon, see docs I think there is no other way than building a conversion table between the icons, this is a lot of work so need to see Icons in OsmAnd are given as an extension element <gpx>
<wpt>
...
<extensions>
<osmand:icon>food_restaurant</osmand:icon>
...
</extensions>
</wpt>
</gpx> ShapeOSMAnd only supports three shapes (circle, square, octagon) <gpx>
<wpt>
...
<extensions>
<osmand:background>circle/square/octagon</osmand:background>
...
</extensions>
</wpt>
</gpx> Custom AttributesAll custom attributes added in FacilMap can simply be added as additional elements to the extensions element. <gpx>
<wpt>
...
<extensions>
<custom_1>My Custom content 1</custom_1>
<Website>urls-will-be-clickable</Website>
<Custom3>Other Content</Custom3>
...
</extensions>
</wpt>
</gpx> TracksOsmAnd supports all kinds of tracks and routes. I tested with <gpx>
<metadata>
...
</metadata>
<extensions>
...
</extensions>
<trk>
<trkseg>
<trkpt>...</trkpt>
...
</trkseg>
</trk>
</gpx> Since tracks only allow for 1 metadata attribute which contains the description, ColorColor is identical to points <gpx>
<metadata> ... </metadata>
<extensions>
<osmand:colour>#f56b00</osmand:colour>
</extensions>
<trk>
...
</trk>
</gpx> WidthOsmAnd supports only three types of width as string ("thin", "medium", "bold") or numbers from 1-24. <gpx>
<metadata> ... </metadata>
<extensions>
<osmand:width>5</osmand:width>
</extensions>
<trk>
...
</trk>
</gpx> Custom AttributesTracks do not support custom attributes like points do but you can have as much description text as required which <gpx>
<metadata>
<osmand:desc>
property 1: value 1
property 2: urls are clickable in app
property 3: value 3
</osmand:desc>
</metadata>
<extensions>
...
</extensions>
<trk>
<trkseg>
<trkpt>...</trkpt>
...
</trkseg>
</trk>
</gpx> |
Here is an overview of all icons: https://unpkg.com/facilmap-leaflet/icontest.html In addition, any single letter can be used as the icon content. |
hi, just wanted to let you know that I will likely not have the time to work on that for the foreseeable future, the documentation is there so should anyone be willing to work on this feel free to pick it up, if I find some time at some point I might pick it up again. Thanks for your amazing application |
What works now on https://beta.facilmap.org/ (note that any maps created/modified there will be deleted once FacilMap 4 is released):
What's still missing:
|
Wow that sounds amazing. Now I only need time for the next vacation so I can plan it using facilmap 😂 Thank you very much for your great work. |
First of all I absolutely love facilmap! I have been search for years for a good vacation planning tool and feel like I have finally found what I was looking for.
Now that I have planned a big trip using facilmap I would love to be able to use all the data I have build offline.
I already played around with multiple android apps that are able to import the GPX files but none of them work as well as facilmap does directly (colors, icons, shapes, tracks get los or scrambled, the legend to hide/show categories is missing, ...)
Are there any tricks I can use or any plans to implement (or some starting points for me to look at) for offline capabilities?
The text was updated successfully, but these errors were encountered: