Vector maps from non-osm sources (gdal)

730 views
Skip to first unread message

Will Kamp

unread,
Oct 20, 2012, 5:43:55 PM10/20/12
to mapsfo...@googlegroups.com
Has anyone played around with creating mapsforge maps from non-osm sources?  I'm starting to work on a project to convert s57 vector nautical charts to the mapsforge format along with a corresponding theme that somewhat mirrors how the OpenCPN.org project renders s57 charts.  I believe this can be accomplished this way.  I'd welcome any input, suggestions or interested parties who would want to work on this along with me.

The current plan is to write a python mapsforge map writer utility that reads s57 files with Gdal/Ogr in a way that a corresponding mapsforge theme could render the charts correctly (see attached image). 

I'm also interested if anyone has has worked on anything similar such as a mapsforge map writer apart from osmosis and the currenty plugin.

Will

--
MXMariner.com - marine navigation for Android
s57example.png

Ludwig

unread,
Oct 20, 2012, 8:15:03 PM10/20/12
to mapsfo...@googlegroups.com
I think your approach is just a little more difficult than it needs to be. I would advice against a special plugin as it just creates a maintenance problem as you have to track any development in the mapsforge plugin. 

I would opt for a converter that reads your files and outputs them in OSM format. Then the files can be read just as an input file to the unmodified mapfile writer (just make sure your tags are being included in the map file by adjusting the tag-mapping). This adds a step in your map-making chain but eliminates heavy coding/dependencies. Plus it will result in a more reusable utility.

There was a discussion here on this list on using shape2osm for converting coastline shapefiles. 

I do not know anything about s57 charts but if there is a way to convert them into an OGR readable file, you are halfway there as then you can simply use ogr2ogr to perform the conversion. 

Ludwig

Will Kamp

unread,
Oct 22, 2012, 2:20:06 PM10/22/12
to mapsfo...@googlegroups.com
Ludwig,

Good advice... thank you.  Yes, s57 is indeed an OGR readable format.  I have successfully converted an s57 to osm with http://wiki.openstreetmap.org/wiki/Ogr2osm (ogr2osm.py UVM).  However, I have not have much success with maps-forge-writer osmosis plug-in being able to convert the attached US1WC01.osm file.  So, this is a start.

In the future, once the conversion process works using the current osmosis plugin I am still planning on creating a s57 to mapsforge map converter program in python.  Many sailors have s57 files of their own.  And, It would be tricky for me to create a small and lean gui program for them to create their own s57/mapsforge maps using the current osmosis mapsforge plugin. (This would be similar to my program MX Cart which converts raster BSB charts to the gemf format)

Thanks,

Will
US1WC01.osm.zip

Ludwig

unread,
Oct 22, 2012, 8:42:07 PM10/22/12
to mapsfo...@googlegroups.com
I did not have much time to look at the osm file, but there might be some issues with it:

1. the use of negative ids for nodes etc. For OSM this means that these entities are not (yet) in OSM. I cannot remember if this actually causes mapsforge to choke on the input, but for the conversion of coastlines I chose to use very high ids (so that they do not conflict with actual OSM ids).

2. some entities are missing, such as 351771, which is referred to by relation 351770. I think mapsforge can handle this. 
I sometimes use JOSM to verify that an OSM file that I generate is actually valid, which helps tracking down errors. You can load your files into JOSM and then click on 'validate' somewhere. However the missing entity seems to stop JOSM to load this file. 

I would suggest starting with a very small file of your data just to get the structure and the conversion right and to make sure that it will validate in JOSM. 

The s57 converter to OSM is certainly only one way how the conversion could be done. Mapsforge, somewhat unfortunately, needs every single tag/value combination listed in the tagmapping. I am not sure what the values in the s57 file mean, maybe there is a way of generalising the mapping a bit to make it easier.

HTH

Ludwig

Will Kamp

unread,
Oct 23, 2012, 12:51:33 AM10/23/12
to mapsfo...@googlegroups.com
The negative ids seem to be ok for the map-writer plugin.  I did have to add version, timestamp and changeset to each node and way in order for the map-writer plugin to accept the osm xml.  As for the tag mapping, it looks like this is where the work begins in creating a render theme.  I'll try to post on further progress.

Thanks,

Will

On Monday, October 22, 2012 5:42:08 PM UTC-7, Ludwig wrote:
... Mapsforge, somewhat unfortunately, needs every single tag/value combination listed in the tagmapping. I am not sure what the values in the s57 file mean, maybe there is a way of generalising the mapping a bit to make it easier.

HTH

Ludwig

Christian Kernbeis

unread,
Oct 24, 2012, 11:35:31 AM10/24/12
to mapsfo...@googlegroups.com
Hi Will,

/*As for the tag mapping, it looks like this is where the work begins in creating a render theme*/

First thing is to tag-transform common tags where the values differ to the tags Mapsforge transports as wildcards.
Eg for Nodes you can highjack ref,name,ele (housenumber ???)

http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile

Otherwise you run into troubles in your Tag-Mapping.xml couse virtualy impossible to define every possible value for a tag
and - as Ludwig said - its not possible to define wildcards ( v="*" )  as value in the tagmapping.

I hope you get the picture.

regards
Christian

Will Kamp

unread,
Nov 11, 2012, 1:33:01 AM11/11/12
to mapsfo...@googlegroups.com
I've started a project for this.  https://github.com/manimaul/mapsforge-senc-rendertheme

The project is still fledgling and lacks many details. 

I also plan on creating maps from NOAA ENC s57 files that will be hosted in the maps directory of the site.  One s57 style world overview map is there now:

https://github.com/manimaul/mapsforge-senc-rendertheme/blob/master/maps/world.map
https://raw.github.com/manimaul/mapsforge-senc-rendertheme/master/screenshots/device-2012-11-10-221317.png


vklein

unread,
Nov 12, 2012, 1:33:33 PM11/12/12
to mapsfo...@googlegroups.com
I found a lot of nice pngs for bouys. Good work!
I might use them in my app.
I looked at one of the pngs  with Firefox, but if I download it it is not displayed in  a viewer,
I must load it with firefox and save it from there, then it is displayed? why?
 Regards

Victor



علی بهزادیان نژاد

unread,
Nov 12, 2012, 2:49:02 PM11/12/12
to mapsfo...@googlegroups.com
Hi manimaul!

Nice work! Would you please tell me more about file format and 
how can I modify/improve it and also how to create map files 
with this format?

Thanks
Ali
Reply all
Reply to author
Forward
0 new messages