Missing sea on my own map

358 views
Skip to first unread message

Charles Sweeney

unread,
Apr 23, 2015, 2:45:47 PM4/23/15
to mapsfo...@googlegroups.com
Making my own map with the latest version of the map writer (mapsforge-map-writer-0.5.1.jar).

Using a custom tag mapping file based on the original tag-mapping.xml here:

https://github.com/mapsforge/mapsforge/blob/master/mapsforge-map-writer/src/main/config/tag-mapping.xml

I simply copied the original then edited it.  I know the file is getting read as I can see changes I have made to it showing on the map.  I didn't edit any reference to the sea.

I'm not getting the sea.  I'm using mapsforge 0.5.1 libraries.  When using the map from mapsforge I get the sea.  I'm using the same render theme for both maps.

The map data is great-britain-latest.osm.pbf from Geofabrik (fresh download).


Ludwig

unread,
Apr 23, 2015, 2:48:53 PM4/23/15
to mapsfo...@googlegroups.com
The problem is that the sea data is not processed correctly by mapsforge. 

There is an institutionalized work-around for this at https://github.com/mapsforge/mapsforge-mapcreator, which utilizes prebuild sea area polygons. 

The best might  be to clone the project, change the xml/config file to your requirements and run the process.

Ludwig


--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/77c7b401-c337-4312-b8b0-abfbf3f0b633%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Emux

unread,
Apr 23, 2015, 2:52:33 PM4/23/15
to mapsfo...@googlegroups.com
The most "easy" way to put sea on a map with land polygons could be to paint the map background blue.

But in our map generation process, we simply use a rectangle under land polygons and all other layers which is painted blue.

Search for natural=sea in tag-mapping and render theme to see their use.

--
Emux
Cruiser - Atlas

Charles Sweeney

unread,
Apr 23, 2015, 2:56:25 PM4/23/15
to mapsfo...@googlegroups.com
Thanks for the swift response, Ludwig.

Charles Sweeney

unread,
Apr 27, 2015, 3:58:28 AM4/27/15
to mapsfo...@googlegroups.com
Thanks too, Emux.

I have been using the mapsforge mapcreator for three days now (trying to use it - new to this - had some problems with Python libraries).  Just about got it working, getting this error:

Traceback (most recent call last):
  File "mapcreator.py", line 421, in <module>
    main()
  File "mapcreator.py", line 369, in main
    creator.evalPart(root, initial_source_pbf, '', '', zoom_interval_conf, land_simplification)
  File "mapcreator.py", line 102, in evalPart
    self.landExtractor.extract_land_polygons(staging_path + current_part_name, self.pbf_staging_path, land_simplification)
  File "/home/ubuntu/osmosis/mapsforge-mapcreator/landextraction.py", line 138, in extract_land_polygons
    success = subprocess.call(ogr_call)
  File "/usr/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Having said that.  I was looking for a way to select which OSM tags are used in the map such as the tag-mapping.xml file used with the map writer on Osmosis, but can't see how to select tags when using the mapsforge mapcreator, so it may be pointless anyway for me to use it.  I am making a clean map with minimal data, so want to reduce the file size considerably by leaving out a lot of the tags.  If I can't do that with mapcreator I would be better off just using the stock mapsforge maps.

Using the map writer with tag-mapping.xml I was able to disable tags and make a smaller file but of course I was getting the problem with the sea.  Thank you for your suggestion about the background for the sea, I will have a look at it.

Ludwig

unread,
Apr 27, 2015, 5:26:15 AM4/27/15
to mapsfo...@googlegroups.com
I thought this was fixed (cannot check right now), but what is missing is a file for the land/sea data. Have a look in the landextraction.py file and there is possibly still a line commented out that downloads that file. Just uncomment that line

Ludwig


--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.

Emux

unread,
Apr 27, 2015, 5:40:38 AM4/27/15
to mapsfo...@googlegroups.com
On 27/04/2015 12:26 μμ, Ludwig wrote:
I thought this was fixed (cannot check right now), but what is missing is a file for the land/sea data. Have a look in the landextraction.py file and there is possibly still a line commented out that downloads that file. Just uncomment that line

Yes it's uncommented (landextraction.py#L123).

Charles Sweeney

unread,
Apr 27, 2015, 7:58:06 AM4/27/15
to mapsfo...@googlegroups.com
Tried painting the map background blue, which gave me the "sea" but also gave me large areas of land also the same colour as the "sea", resulting in the land looking flooded.  I'm using great-britain-latest.osm.pbf

I think the best solution would be to use mapsforge mapcreator with custom tag selection...if this can be done.

Emux

unread,
Apr 27, 2015, 8:18:59 AM4/27/15
to mapsfo...@googlegroups.com
You used the "map-background" tag in render theme for setting the blue sea?

You can have blue sea, either with the above generic method or preferably with a blue rectangle below all layers and natural=sea tag.

But for this to work correctly you need land polygons (from OpenStreetMap Data) above the sea, not just coastline lines.

If you want to learn how this procedure works, Ludwig had explained it some time ago.

Emux

unread,
Apr 27, 2015, 8:20:39 AM4/27/15
to mapsfo...@googlegroups.com
Here is the link.

Charles Sweeney

unread,
Apr 27, 2015, 11:04:16 AM4/27/15
to mapsfo...@googlegroups.com
Thanks, Emux.

Yeh, just set map-background to blue.

I'll have a look at the link.

Would still be interested in getting the mapcreator fixed and seeing if I can use it with custom tag selection.

Charles Sweeney

unread,
Apr 29, 2015, 2:15:41 PM4/29/15
to mapsfo...@googlegroups.com
Worked beautifully.  I did have a problem with very small islands being sunk but discovered they were closed coastlines so simply changed the fill colour for them to the same colour as the "nosea" land, #F8F8F8, in my render theme:

<rule e="way" k="natural" v="coastline">
                <rule e="way" k="*" v="*" closed="no">
                    <line stroke="#708599" stroke-width="0.2" />
                </rule>
                <rule e="way" k="*" v="*" closed="yes">
                    <area fill="#F8F8F8" stroke="#b5d6f1" stroke-width="0.4" />
                </rule>
            </rule>




On Monday, April 27, 2015 at 1:20:39 PM UTC+1, Emux wrote:

Emux

unread,
Apr 29, 2015, 2:20:40 PM4/29/15
to mapsfo...@googlegroups.com
Islands with no land is the usual coastline issue.

I understand you used line coastline and no land polygons?

Charles Sweeney

unread,
Apr 29, 2015, 2:48:15 PM4/29/15
to mapsfo...@googlegroups.com
I followed your advice and used the work-around solution of polygons for the land areas painted as land, on top of the map background painted the colour of the sea.

My map is Britain and the many surrounding small islands and rocks.  After implementing the work-around I was left with some very small islands appearing to be submerged, or with no land I suppose you could say, which I also noticed were tagged as closed coastlines, so simply changing the fill colour for them from a sea colour to that of the land fixed the problem.  The map is now perfect as far as I can tell.

I think it's quite a good work-around, actually.

Charles Sweeney

unread,
Apr 29, 2015, 2:52:23 PM4/29/15
to mapsfo...@googlegroups.com
I followed your advice and used the work-around solution of polygons for the land areas painted as land, on top of the map background painted the colour of the sea.

My map is Britain and the many surrounding small islands and rocks.  After implementing the work-around I was left with some very small islands appearing to be submerged, or with no land I suppose you could say, which I also noticed were tagged as closed coastlines, so simply changing the fill colour for them from a sea colour to that of the land fixed the problem.  The map is now perfect as far as I can tell.

I think it's quite a good work-around, actually.

On Wednesday, April 29, 2015 at 7:20:40 PM UTC+1, Emux wrote:

Emux

unread,
Apr 29, 2015, 2:53:36 PM4/29/15
to mapsfo...@googlegroups.com
On 29/04/2015 09:48 μμ, Charles Sweeney wrote:
After implementing the work-around I was left with some very small islands appearing to be submerged, or with no land I suppose you could say, which I also noticed were tagged as closed coastlines, so simply changing the fill colour for them from a sea colour to that of the land fixed the problem.

That puzzled me. There are not supposed to exist any such issues.

Are you using at the same time land polygons from OpenStreetMap Data and coastline from some other source?
(That could explain the mismatch)

Charles Sweeney

unread,
Apr 29, 2015, 4:52:53 PM4/29/15
to mapsfo...@googlegroups.com
Just following the work-around instructions, the land polygons are from:

http://data.openstreetmapdata.com/land-polygons-split-4326.zip

The map data is in the pbf file I got from Geofabrik:

http://download.geofabrik.de/europe/great-britain-latest.osm.pbf

Emux

unread,
Apr 30, 2015, 2:23:22 AM4/30/15
to mapsfo...@googlegroups.com
The OpenStreetMap Data land / water / coastline geodata are pre-processed / repaired.
So the Geofabrik coastline may not be exactly equal.

For that I usually prefer using land and coastline from the same source (OpenStreetMap Data).
Or paint the land polygons with stroke to produce coastline effect.

Charles Sweeney

unread,
Apr 30, 2015, 12:17:34 PM4/30/15
to mapsfo...@googlegroups.com
Good advice.  Thank you.  I did notice one or two slight differences between the land polygon and the coastline.  They were very minor and didn't look bad but I agree it would be better to use the same source if they use the same data/methodology to make their coastlines and land polygons.

On Thursday, April 30, 2015 at 7:23:22 AM UTC+1, Emux wrote:
The OpenStreetMap Data land / water / coastline geodata are supposed to be pre-processed / repaired.

So the Geofabrik coastline may not be exactly equal.

For that I usually prefer using land and coastline from the same source (OpenStreetMap Data).
Or paint the land polygons with stroke to produce coastline effect.

Reply all
Reply to author
Forward
0 new messages