Updating OSM in Phonegap


I am designing an app that will allow the user to update the OSM on their device with new roads, these new roads will then be used in future gps routing calculation,
I am using Cordova/Phonegap for this app, I have a prototype app that can track the users movements on an OSM but this map is not stored locally on the phone so it cant be updated in the manner that I want it to be. I am struggling to see what technologies I can use to give the user a map that they can update. Has anyone any suggestions ?

Recently I read about https://github.com/afsuarez/mapsforge-cordova-plugin … it uses offline map files based on mapsforge.

But from all solutions that use offline maps for routing based on OSM data, I never heard of a feature to modify its content on a user end device to enable a different routing.

If you want to be sure, why not ask on the mapsforge googlegroup mailinglist whether it is possible to edit produced mapsforge map files?

And: what solution do you use for routing/navigation?

Thanks for replying that link looks really helpful.

I am still working on my solution for routing and navigation, this is a project for college so I am limited in what plugins I use, the routing/navigation is probably something I will need to implement myself if possible, its pretty daunting :/.

… but you know about several opensource solutions at http://wiki.openstreetmap.org/wiki/Routing and http://wiki.openstreetmap.org/wiki/Frameworks ??

There are even more hints in the OSM wiki … browse around there …

and also see http://help.openstreetmap.org for particular FAQ

Thank you.

Do you have any idea on what data I should extract from OSM to use for routing ? I was playing arounf with qGis earlier, I was extracting nodes from OSM maps. There is huge amounts of data in them so I’m not sure if im on the right track

Has anyone any experience of using pgrouting with OSM ?

If I want to update my own version of an OSM map, can I just edit the xml files to add ways new nodes and ways ? Any advice about how I add new id’s for ways and nodes ?

If you only want to add a bunch of new elements, try to load that raw OSM data in JOSM, do NOT upload the new data to the OSM main server, but save as a file locally.

Try that in the beginning with a very small OSM file and inspect that after local saving with a capable text editor like UltraPad, PSPad or Notepad++

The usual procedure is to use negative ids (this is essentially what all editors do), however I’m not convinced that using the normal OSM format will actually help a lot. Given that would require you to at least partially rebuild geometries every time you update I suspect that it might be too expensive.

Do you mind explaining this bit a bit more ?

I am starting to think this project is just not possible

Thanks, I will give that a go

All the geometry information in OSM data is in the nodes, so if you want to draw a way you need to build the corresponding object by builing for example a linestring out of the way and the nodes that the way references.

Do you have any suggestions about how I could go about updating the map data ?

Tell us first:

  1. What raw map data is your source? is it a file? Which format? What file size? on your PC or somewhere in the web?

  2. Do you want to update that OSM data that is “only” in a file on your PC or is it in any kind of database?

  3. What is the way you want to go further with that data? Please tell us in detail and give us examples what is working so far" Do you want to use for example osmosis to produce map files for mapsforge? or Osmand-Mapcreator to use in Osmand app?

1, I have downloaded the maps in xml/osm format and dumped the data into a postgres database, from here I have installed PG-Routing to the database and I can run run shortest path queries on the data from the file. What I need to do is find a way to update the data that has been dumped into the database and for these updates to be used by PG-Routing

  1. I am flexible on this, I need to be able to carry out Sat-Nav routing on the map once I have updated it, I am currently using PG Routing as I mentioned in point 1.

  2. I need to be able to allow a user of the application to update the map with new roads and for these roads to be considered in future routing calculations, I am struggling with the concept of going from updating the maps to getting those routes to be considered in routing quries by PG- Routing, that is of course if PG-Routing is the appropriate software to use for what I am trying to achieve.

What I have got so far is the section of OSM data dumped into the database and I can carry out PG Routing queries, I also have an app on my phone that will allow the user to record a new route/road, I then want to take this data and add it to my own OSM map. This is also another area that I am struggling to understand how to format this data so that when I add it to the database it is valid and usable for routing queries

Finally you gave the important information about using pgrouting … that took a long time …

Sorry for having no concrete solution for your aim, but I would recommend to ask your question about adding new elements to a database for use in pgrouting

  1. at one of the two pgrouting mailing lists, or

  2. ask at gis.stackexchange.com

but I recomment to search on both channels whether someone has asked similar to you before.

Thanks for replying, sorry if I was a bit reluctant on the info, I am trying to figure out that this is possible as well as implementing it.