Help: How to add OpenSeaMap seamarks to a mapsforge map?

1,254 views
Skip to first unread message

vklein

unread,
Nov 6, 2012, 5:25:38 PM11/6/12
to mapsfo...@googlegroups.com
Hi,
I plan to add Openseamap seamarks to a mapsforge map.
 For first tests I want to add support for buoys.
I have a little testfile from Warnemünde with some seamarks in it.

As I understood I have to to three things:
 1. I have to edit the tag-mapping file in the mapwriter project and add support for buoys, then  build a new writer
 2. with this I can write a map-file that contains the buoys
 3. I have to add a custom RenderTheme based on the Osmarender found in the mapsforge-map project

A buoy ( it's the buoy 17 in front of  warnemünde ) is coded in the my osm-file as follows:

<node id='285061565' timestamp='2011-06-20T19:24:00Z' uid='128186' user='malcolmh' visible='true' version='23' changeset='8497890' lat='54.1889751' lon='12.0870519'>

<tag k='buoy' v='lateral_starboard' />

<tag k='buoy:colour' v='green' />

<tag k='buoy:shape' v='pillar' />

<tag k='light' v='yes' />

<tag k='light:character' v='Fl' />

<tag k='light:colour' v='green' />

<tag k='light:description' v='Fl.G.4s' />

<tag k='light:period' v='4' />

<tag k='name' v='17' />

<tag k='seamark' v='buoy' />

<tag k='seamark:buoy_lateral:category' v='starboard' />

<tag k='seamark:buoy_lateral:colour' v='green' />

<tag k='seamark:buoy_lateral:shape' v='pillar' />

<tag k='seamark:buoy_lateral:system' v='iala-a' />

<tag k='seamark:light:character' v='Fl' />

<tag k='seamark:light:colour' v='green' />

<tag k='seamark:light:period' v='4' />

<tag k='seamark:name' v='17' />

<tag k='seamark:type' v='buoy_lateral' />

</node>

 
I have studied some related documents but I have no idea to nr. 1

For the nr. 3 I would add a rule to the osmarender

<!-- should match all nodes with a "buoy=lateral_starboard" tag on zoom level 8 and above, its a try, the windmill is in the mapsforge lib -->

    <rule e="node" k="buoy" v="lateral_starboard" zoom-min="8">
        <symbol src="jar:/org/mapsforge/android/maps/rendertheme/osmarender/symbols/windmill.png" />
        <caption k="name" font-style="bold" font-size="10" fill="#4040ff" />
    </rule>

How can I access png's that are in R.drawable? 
The windmill is only a existing symbol in the mapsforge lib.


Help appreciated.




 


.




Will Kamp

unread,
Nov 6, 2012, 7:49:05 PM11/6/12
to mapsfo...@googlegroups.com
I'm pretty sure you can put images in a directory of the assets folder put the path in your rendertheme...

src="jar:/assets/rendertheme/symbols/buoy.png"

Will Kamp

unread,
Nov 6, 2012, 7:57:33 PM11/6/12
to mapsfo...@googlegroups.com
I should probably also mention that there is a good set of images for seamarks here that follow the s57 standard:

https://github.com/OpenCPN/OpenCPN/tree/master/data/s57data

Additionally, I've just started work on a rendertheme for seamarks.  I've been meaning to open up a separate project for this.  I think it would be possible to render seamarks in a way that pretty closely matches the s57 standards.

Will

vklein

unread,
Nov 7, 2012, 4:06:21 AM11/7/12
to mapsfo...@googlegroups.com
Hi Will,
thanks for the hint to read files.

There is a wiki http://wiki.openstreetmap.org/wiki/Openseamap/Seamark_Tag_Values that describes the data model of my testfile from waremünde.

Victor

Thilo Mühlberg

unread,
Nov 7, 2012, 5:09:35 PM11/7/12
to mapsfo...@googlegroups.com
You cannot use resource files in a render-theme currently, but you can
reference images on the file system via src="file:/path/to/file.png".

If you omit the leading slash, the path will be interpreted as relative
with respect to the location of the render-theme XML file.

Greetings,
Thilo
signature.asc

vklein

unread,
Nov 7, 2012, 6:38:14 PM11/7/12
to mapsfo...@googlegroups.com
Hi Thilo,
thanks

My first problem ( how to put the bouy data in the map file ) is unsolved
The wiki is rather short on this issue. As I used the download feature till now (runs fine with the patched 030 lib), I am very new to all the rendering things.
Maybe there is a very simple solution for this.
I guess that I have to add something to the tag-mapping.xml in the mapsforge-map-writer like
 <ways>
      <osm-tag key="seamark" value="buoy" zoom-appear="13" />
</ways>

but I can't debug the map building process.to see if the  buoys data is added.

The next problem would be a appropriate rendertheme.

The whole set of seamarks is defined by  malcolnh who maintains the openseamap tile server.
But I want to know a little bit more how to use the mapsforge writer and renderthemes.



Victor

Will Kamp

unread,
Nov 7, 2012, 7:34:11 PM11/7/12
to mapsfo...@googlegroups.com
Victor,

I think we are on the same path here.  It looks like there is some tag mapping to be done.  I haven't found much information on mapping tags as I am still working on it myself and trying to pick up on mapsforge in general.  Take a look here:

http://code.google.com/p/mapsforge/source/browse/trunk/mapsforge-map-writer/src/main/config/tag-mapping.xml

Perhaps someone else could chime in on exactly what is involved in mapping custom tags in both 0.30 and current?

Will Kamp

unread,
Nov 8, 2012, 9:37:34 AM11/8/12
to mapsfo...@googlegroups.com
After some playing around, I can confirm how mapping tags is done.  I'm sure this is documented somewhere else more thoroughly.

1. The mapsforge-map-writer/src/main/configtag-mapping.xml file needs to be edited to include the custom tags you want.
2. Then rebuild mapsforge-map-writer
3. Create your map file from the osm file containing the custom tags
4. Confirm that your rendertheme.xml (default is osmarender.xml) has rules supporting your new tags.

Will

Jürgen Broß

unread,
Nov 8, 2012, 9:46:45 AM11/8/12
to mapsfo...@googlegroups.com
You can configure the mapfile-writer to use a custom tag-mapping by
using the option 'tag-conf-file=<path-to-file>', see [1].

This makes step 2. obsolete, i.e. no rebuild of the writer is necessary.

Regards,
Jürgen

[1]
http://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter#Advanced_Options_(only_use_when_you_know_what_you_are_doing)
--


Jürgen Broß
Institute of Computer Science
Databases and Information Systems
Freie Universität Berlin
Takustr. 9
D-14195 Berlin, Germany
phone: +49 30 838-75108
email: juerge...@fu-berlin.de

signature.asc

vklein

unread,
Nov 9, 2012, 5:16:16 AM11/9/12
to mapsfo...@googlegroups.com
Hi all
only_use_when_you_know_what_you_are_doing
thats the problem
I can compile a map file with the following openseamap-tag-mapping.xml. It produces a map, but no bouys in it
The info about the marina seems to be contained.

I have not understood the mapping-process  with the tags. I assumed that if a key/value pair is in the tag-mapping.xml the information in the affected nodes is put into the maps file, but this seems to be wrong or the new opsenseamap-keys are not recognized.

I discuss it here as I want to talk to the author of the openseamap-tags but I have to get some mininal knowledge.

This is mit tag-mapping.xml.
<?xml version="1.0" encoding="UTF-8"?>
-<tag-mapping profile-name="default-profile" default-zoom-appear="16" xsi:schemaLocation="http://mapsforge.org/tag-mapping tag-mapping.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://mapsforge.org/tag-mapping">
<!-- ************* POIS *************** -->
 
<!-- PUBLIC AMENITIES -->
 -<pois> <osm-tag zoom-appear="13" value="marina" key="leisure"/> </pois>
<!-- ************* WAYS *************** -->
 
<!-- NATURAL / WATERWAY TAGS -->
 -<ways> <osm-tag zoom-appear="13" value="buoy" key="seamark"/> </ways>
 </tag-mapping>


I start it with
D:\josmData\osmosis-0.41>bin\osmosis --rx file=D:\josmData\osmosis_input\Warnemu
ende.osm --mw file=D:\josmData\osmosis_output\warnemuende_with_buoys_041coastlin
e.map type=ram coastline-mode=0 tag-conf-file=D:\josmData\osmosis_input\opensea-
tag-mapping.xml bbox=54.1704737,11.9902039,54.3677585,12.1179199
Nov 09, 2012 10:43:30 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Osmosis Version 0.41
Nov 09, 2012 10:43:31 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Preparing pipeline.
Nov 09, 2012 10:43:31 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask <ini
t>
Information: mapfile-writer version: mapsforge-map-writer-0.3.1-SNAPSHOT
Nov 09, 2012 10:43:31 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask <ini
t>
Information: mapfile format specification version: 3
Nov 09, 2012 10:43:31 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Launching pipeline execution.
Nov 09, 2012 10:43:31 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Pipeline executing, waiting for completion.
Nov 09, 2012 10:43:31 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask proc
ess
Information: start reading data...
Nov 09, 2012 10:43:32 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask prep
rocessCoastlines
Information: Starting Coastline Processing...
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask prep
rocessCoastlines
Information: Finished Coastline Processing!
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: current max way id: 186110031
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: completing read...
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: current max way id: 186110031
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: start writing file...
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 100% of sub file for zoom interval index 0
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 100% of sub file for zoom interval index 1
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 10.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 20.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 30.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 40.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 50.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 60.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 70.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 80.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeSubfile
Information: written 90.0% of sub file for zoom interval index 2
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeFile
Information: JTS Geometry cache hit rate: 1.0
JTS Geometry total load time: 0
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.MapFileWriter writeFile
Information: Finished writing file.
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: finished...
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: estimated memory consumption: 183,5MB
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: maximum monitored memory consumption: 0MB
Nov 09, 2012 10:43:33 AM org.mapsforge.map.writer.osmosis.MapFileWriterTask comp
lete
Information: estimated runtime: 2121ms = 02.121s
Nov 09, 2012 10:43:33 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Pipeline complete.
Nov 09, 2012 10:43:33 AM org.openstreetmap.osmosis.core.Osmosis run
Information: Total execution time: 2964 milliseconds.

D:\josmData\osmosis-0.41>

if I open the map file, I can see that information about the marina is written ( this is new in comparision with the old file)

but I can see noc info about the bouys
 
Victor

Jürgen Broß

unread,
Nov 9, 2012, 5:51:37 AM11/9/12
to mapsfo...@googlegroups.com
Does your render-theme support the new tag? See step 4. in Will's mail
from yesterday.

The tag-mapping defines what's INCLUDED in the map file. The
render-theme defines what's RENDERED (and how) in your application. Just
including an entity in the map file does not mean that it is
automatically rendered. Vice versa, entities that are not included in
the file cannot be rendered despite the fact that a rule may have been
defined in the theme.

Regards,
Jürgen


On 09.11.2012 11:16, vklein wrote:
> Hi all
> only_use_when_you_know_what_you_are_doing<http://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter#Advanced_Options_%28only_use_when_you_know_what_you_are_doing%29>
>> email: juerge...@fu-berlin.de <javascript:>
signature.asc

vklein

unread,
Nov 9, 2012, 3:07:09 PM11/9/12
to mapsfo...@googlegroups.com, juerge...@fu-berlin.de
my render theme is as follows but I get an error "Die gewählte Datei ist ungültig. unsupported render theme version: 1"


<?xml version="1.0" encoding="UTF-8"?>
    <rendertheme xmlns="http://mapsforge.org/renderTheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://mapsforge.org/renderTheme renderTheme.xsd" version="1">
  
       <!-- should match all nodes with a "buoy=lateral_starboard" tag on zoom level 8 and above,  -->


    <rule e="node" k="buoy" v="lateral_starboard" zoom-min="8">
        <symbol src="jar:/assets/rendertheme/symbols/buoy_green.png"/>

        <caption k="name" font-style="bold" font-size="10" fill="#4040ff" />
    </rule>
</rendertheme>

If I set version="2" it executes, but nothing  is shown except a string "Hohe Düne" on tile X:2185,Y=1311;Z=12

Do you have any hint which class I should debug to see whats going on with the rendering?

Regards
Victor

I have tried to attach a file with a screenshot to my post, but posting crashes, so I renew it without attachment.

Christian Kernbeis

unread,
Nov 10, 2012, 9:05:03 AM11/10/12
to mapsfo...@googlegroups.com, juerge...@fu-berlin.de

Hi Victor,



Do something like this:


<?xml version="1.0" encoding="UTF-8"?>
<tag-mapping xmlns="http://mapsforge.org/tag-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://mapsforge.org/tag-mapping ../resources/tag-mapping.xsd" default-zoom-appear="16"
    profile-name="default-profile">

     <!-- Seamap tags -->
    <pois>
        <osm-tag key="buoy:colour" value="green" renderable="false" />
        <osm-tag key="buoy:colour" value="red" renderable="false" />   

        <osm-tag key="buoy" value="lateral_starboard" zoom-appear="10" />       
        <osm-tag key="buoy" value="lateral_port" zoom-appear="10" />       
    </pois>
   
</tag-mapping>


<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns="http://mapsforge.org/renderTheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://mapsforge.org/renderTheme ../renderTheme.xsd" version="1" map-background="#F8F8FF">

            <!-- render land above water -->
                <rule e="way" k="*" v="*">
                    <rule e="way" k="natural" v="sea">
                        <area fill="#b5d6f1" />
                    </rule>
                    <rule e="way" k="natural" v="nosea">
                        <area fill="#f8f8f8" />
                    </rule>
                </rule>
               
            <!-- beginn openseamap -->
           
                <rule e="node" k="buoy" v="lateral_starboard|lateral_port">
                    <rule e="node" k="buoy:colour" v="red">
                        <circle r="8" fill="#ec2d2d" stroke="#606060" stroke-width="1.5" />
                        <caption k="name" dy="-10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
                    </rule>
                    <rule e="node" k="buoy:colour" v="green">
                        <circle r="8" fill="#18ec34" stroke="#606060" stroke-width="1.5" />
                        <caption k="name" dy="-10" font-style="bold" font-size="16" fill="#18ec34" stroke="#ffffff" stroke-width="2.0" />
                    </rule>
                </rule>           
 </rendertheme>

And, for the start, I recommend to use the standard 0.30 Version with osmosis 0.40.1 couse its stable - otherwise you cant sort out from where the troubles appear.

best regards
Christian

vklein

unread,
Nov 12, 2012, 5:54:02 AM11/12/12
to mapsfo...@googlegroups.com

Hi Christian,
thank you for the nice hints to the tag-mapping xml and the renderheme.
They work and I played around with them.
The trick with the circle was very helpfull to isolate the problems.

This is the tag-mapping  and the rendertheme ( build at the top of the tag-mapping of mapsforge030 and end of osmarender) I use:

  <!-- Seamap tags -->
    <pois>
        <osm-tag key="buoy:colour" value="green" renderable="false" />
        <osm-tag key="buoy:colour" value="red" renderable="false" />
        <osm-tag key="buoy:colour" value="yellow" renderable="false" />
        <osm-tag key="buoy:colour" value="red-white" renderable="false" />

      
        <osm-tag key="buoy" value="lateral_starboard" zoom-appear="10" />      
        <osm-tag key="buoy" value="lateral_port" zoom-appear="10" /> 
        <osm-tag key="buoy" value="special_purpose" zoom-appear="10" />
        <osm-tag key="buoy" value="safe_water" zoom-appear="10" />  

        <osm-tag key="buoy" value="cardinal_south" zoom-appear="10" />
        <osm-tag key="buoy" value="cardinal_north" zoom-appear="10" />  
    </pois>
....
rendertheme:
....
 <!-- begin opensea map -->

     <rule e="node" k="buoy" v="lateral_starboard|lateral_port">
         <rule e="node" k="buoy:colour" v="red">
             <!--  <circle r="8" fill="#ec2d2d" stroke="#606060" stroke-width="1.5" /> -->
             <symbol src="jar:/assets/rendertheme/symbols/buoy_red.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />

         </rule>
         <rule e="node" k="buoy:colour" v="green">
             <symbol src="jar:/assets/rendertheme/symbols/buoy_green.png"/>
             <!-- <circle r="8" fill="#18ec34" stroke="#606060" stroke-width="1.5" /> -->
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#18ec34" stroke="#ffffff" stroke-width="2.0" />
         </rule>
     </rule> 
     <rule e="node" k="buoy" v="cardinal_south|cardinal_north">
         <rule e="node" k="seamark:buoy_cardinal:colour" v="yellow;black">
             <!--  <circle r="8" fill="#ec2d2d" stroke="#606060" stroke-width="1.5" />-->
             <symbol src="jar:/assets/rendertheme/symbols/buoy_cardinal_south.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
          <rule e="node" k="seamark:buoy_cardinal:colour" v="black;yellow">
             <circle r="8" fill="#002d2d" stroke="#606060" stroke-width="1.5" />
             <symbol src="jar:/assets/rendertheme/symbols/buoy_cardinal_east.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
       
     </rule>
     <rule e="node" k="buoy" v="special_purpose">
         <rule e="node" k="buoy:colour" v="yellow">
            <!--   <circle r="8" fill="#18ec34" stroke="#606060" stroke-width="1.5" /> -->
             <symbol src="jar:/assets/rendertheme/symbols/buoy_special_purpose1.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
       
     </rule> 
     <rule e="node" k="buoy" v="safe_water">
         <rule e="node" k="buoy:colour" v="red-white">
             <!--  <circle r="8" fill="#18ec34" stroke="#606060" stroke-width="1.5" />-->
             <symbol src="jar:/assets/rendertheme/symbols/buoy_safe_water_pillar.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
       
     </rule>   

But I do not really understand why the tag e.g <osm-tag key="buoy:colour" value="red-white" renderable="false" />  is necessary.
Where I can get information about those parameters? The information on GettingStartedMapWriter is rather short.

The cardinal bouys are not shown on the map.  I now think that I have to add a osm-tag like <osm-tag key="seamark:buoy_cardinal:colour" value="yellow;black" renderable="false" />

I have not tested it, but this leads to the main problem:
 
malcolmh ( he maintains the openseamap tile server ) has defined a new set of tags to decribe seamarks http://wiki.openstreetmap.org/wiki/Openseamap/Seamark_Tag_Values

All new seamarks are coded with this scheme.

I want to include many of the seamarks to the map file,  is there any wildcard ?

A example is:

An example of this tagging scheme is illustrated here. This is of a buoy with topmark and light:

seamark:type=buoy_lateral
seamark:buoy_lateral:category=port
seamark:buoy_lateral:shape=pillar
seamark:buoy_lateral:colour=red
seamark:topmark:shape=cylinder
seamark:topmark:colour=red
seamark:light:colour=red
seamark:light:character=Fl
seamark:light:period=5
seamark:name=No.10


the rendertheme needs the other key/values to display the correct symbol for the bouy.

I found no tags with renderable= "false" in the tag-mapping of mapsforge0.30 so there must be another trick or secret to include all the other key/value pairs.

maybe you have hint for me

regards

Victor

Christian Kernbeis

unread,
Nov 12, 2012, 7:49:44 AM11/12/12
to mapsfo...@googlegroups.com
Hi Victor,

The basic problem is that you HAVE to define every key/value pair in the tag-mapping, there are NO wildcards.

The only tags that are moved to the map by default are:
nodes:
- name
- ele
- housenumber (I never used it, so Im not shure that his works)
ways:
- ref
- name
- housenumber

Its documented here: http://code.google.com/p/mapsforge/wiki/SpecificationBinaryMapFile

All other pairs have to be defined in the tag-mapping!

So, if you want to transport the "name" of a seamark you have to tag-transform those stupid "seamark[whatever]:name" to "name" right WITHIN the base osm-file bevore you feed it into the mapwriter - and now its moved into the mapfile without defining it in the tag-mapping.
Now you can chose 2 more tags that you want to map without defining it in the tag-mapping by moving it to eg. "ref" or "ele" or "housenumber".
But take care there may be restrictions concerning the type of var alowed as "v"alues for these tags.

All other seamark tags have to be defined in the tagmapping, renderable= false if you only need use them only as flags.

This sounds complicated. However, its a matter of bringing all possible tags in a scheme eg:

seamark:buoy_lateral:colour=red
seamark:buoy_else:colour=red
seamark:buoy_other=red

can be modified to a simple "buoy:colour"="red" > now you save 2 pairs in the tagmapping

maybe you can even cut of the "buoy:" if this simply defines the painting of the body of the seamark and define a propritary tag such as "SmBody"="red"
now you can use this information (painting of body structure of seamark) for every seamark (where you tagtransform the approbriate tag).
It saves you tonns of lines in the rendertheme an data overhead (this is an issue!!)

This tag-transforming is done by the osmosis plugin tag-transform or by perl/phyton scripting.
http://wiki.openstreetmap.org/wiki/Osmosis/TagTransform
while extreme powerfull it probably takes some nights to get on this horse ;-)

So i recommend to investigate in brief what information _really_ have to be displayed on the phone, simplify the taging scheme of the seamarks aso...


best regards
Christian
www.openandromaps.org

vklein

unread,
Nov 12, 2012, 8:40:05 AM11/12/12
to mapsfo...@googlegroups.com
Hi Christian,
 thank you for the detailed answer.
I got some easy tags working.
<pois>
 <osm-tag key="seamark:buoy_lateral:colour" value="red" renderable="false" />
 <osm-tag key="seamark:buoy_lateral:colour" value="green" renderable="false" />
 <osm-tag key="seamark:type" value="buoy_lateral" zoom-appear="10" />  
</pois>


<!-- begin opensea map -->
       <rule e="node" k="seamark:type" v="buoy_lateral">
         <rule e="node" k="seamark:buoy_lateral:colour" v="red">

             <symbol src="jar:/assets/rendertheme/symbols/buoy_red.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
         <rule e="node" k="seamark:buoy_lateral:colour" v="green">

             <symbol src="jar:/assets/rendertheme/symbols/buoy_green.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
      </rule>

 There remain some problems since not all buoy-symbols are shown,  sometimes only the names.
While zooming, some buoys-symbols  disappear and the name is shown, a green buoy is shown but the red disappiers.
I think there are some problems in the optimisation while png is shown.

I now can report that there is a way to a offline solution for the openseamap and the seamarks.Great!!!

As there are a lot of problems with sector fire (Sektorenfeuer)  I have to get more help.
I am merely a app hobby-programmer and not an expert in designing tagging schemes.
I will now get in contact with malcolmh and the other people from openseamap and  ask them.

best regards


Victor

vklein

unread,
Nov 12, 2012, 8:59:41 AM11/12/12
to mapsfo...@googlegroups.com
Error: unsupported render theme version: 1
My  rendertheme works with mapsforge030 but not with the the new Advanced Map Viewer based on snapshot 0.3.1.

<?xml version="1.0" encoding="UTF-8"?>
<rendertheme xmlns="http://mapsforge.org/renderTheme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://mapsforge.org/renderTheme ../renderTheme.xsd" version="1" map-background="#f8f8f8">

<!-- begin opensea map -->
       <rule e="node" k="seamark:type" v="buoy_lateral">
         <rule e="node" k="seamark:buoy_lateral:
colour" v="red">
             <symbol src="jar:/assets/rendertheme/symbols/buoy_red.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
         <rule e="node" k="seamark:buoy_lateral:colour" v="green">
             <symbol src="jar:/assets/rendertheme/symbols/buoy_green.png"/>
             <caption k="name" dx="+20" dy="+10" font-style="bold" font-size="16" fill="#ec2d2d" stroke="#ffffff" stroke-width="2.0" />
         </rule>
      </rule>
</rendertheme>

Is there a doc of the new structure?

Regards
Victor

Christian Kernbeis

unread,
Nov 12, 2012, 9:42:27 AM11/12/12
to mapsfo...@googlegroups.com
Hi Victor,

Appearing/Disappearing Pois:
Yes, this is a problem with Mapsforge, I tried to set the pois at level+2, but this didnt solve the problem.
Well, for me and the Cycle/Hikingmaps I provide this is no issue (one more or less toilet..)
but for sailors in heavy weather, pfuhhh...

Maybe someone have a solution for this issue.

AND YES ;-))) you found the biggest black hole for seamaps: the sector fires.
I saw this problem several weeks ago when I investigated the possibility of making offline Seamaps ;-)
(I stopped this after some hours cause it was clear that my time budget is'nt sufficiant for this task)

Simple to say: I have no solution for this problem, IMO it's simply impossible to do this inside of standard mapsforge.

There would be a solution, but its heavy affort:
The sectorfire have to be checked and a set of nodes/ways representing the sector fire have to be built by scripting,
building this object and _this_ could be rendered in mapsforge.
...possible but.....

regards
Christian

vklein

unread,
Nov 12, 2012, 12:57:40 PM11/12/12
to mapsfo...@googlegroups.com
Hi Christian, did you ever had contact to malcolmh , who maintains the openseamap tile server? The tiles are transparent pngs with all graphical problems solved (as far as I see).
I hope that I can get some help from him.
I had a short look on your volatile_cycle_hike.xml. Very interesting,especially the nesting in NL/BE cycle nodes. You use rules like <symbol src="file:/symbols/parking.png" /> in the render theme.
As I'm using an old mapsforge030-lib, you place the render theme and the symbols and pattern dirs in the Volatile_cycle_Hike directory?
This may be a better solution than the assets dir.

Regards

Victor

Christian Kernbeis

unread,
Nov 12, 2012, 1:47:09 PM11/12/12
to mapsfo...@googlegroups.com
Hi Victor,

I was in contact with someone of the seamaps team, dont know who it was.
As for the openseamap tiles: This is a tileserver with a very enhanced scripting language on a powerull machine, completely different to mapsforge.

Render Theme: Be carefull, Paths like file:/symbols/parking.png are for Locus only, this App has a very enhanced Theme-handling with a themeswitcher and a completely different directory structure.

The paths I use for usual apps like ORUXMAPS are like this:
symbol src="jar:/org/mapsforge/android/maps/rendertheme/osmarender/symbols/parking.png

or like
symbol src="file:/sdcard/external_sd/OruxMaps/MapsVector/Europe/symbols/parking.png
if I place custom icons in some subfolders of the mapsfolder within ORUX

vklein

unread,
Nov 13, 2012, 9:22:45 AM11/13/12
to mapsfo...@googlegroups.com
Hi Christian,

The random disappear of the symbols is obviously a problem of reading from files, if I  change it to a circle in the rendertheme all buoys are shown.
It seems that the file is read when the renderer executes, normally you would preload the png's and keep them in a membervariable.

I spent some time with the debugger to analyse how the tags in the mapfile are read back.

so I tried with this

  <!-- Seamap tags -->
    <pois>
        <!-- buoys lateral
        example  0 Tag [key=seamark:buoy_lateral:colour, value=green]
                 1 Tag [key=seamark:type, value=buoy_lateral]
                 2 Tag [key=name, value=11] -->

        <osm-tag key="seamark:type" value="buoy_lateral" zoom-appear="10" />
        <osm-tag key="seamark:buoy_lateral:colour" value="red" renderable="false" />
        <osm-tag key="seamark:buoy_lateral:colour" value="green" renderable="false" />
        <!--  beacon lateral
        example:  0 Tag [key=seamark:beacon_lateral:category, value=starboard]
                  1 Tag [key=seamark:beacon_lateral:colour, value=green]
                  2 Tag [key=seamark:type, value=beacon_lateral]
                  3 Tag [key=name, value=Westmolenfeuer]  -->
        <osm-tag key="seamark:type" value ="beacon_lateral" zoom-appear="10"/>  
        <osm-tag key="seamark:beacon_lateral:colour" value="green" renderable = "false" />
        <osm-tag key="seamark:beacon_lateral:category" value= "starboard" renderable = "false" />
        <osm-tag key="seamark:beacon_lateral:colour" value="red" renderable = "false" />
        <osm-tag key="seamark:beacon_lateral:category" value= "port" renderable = "false" />
       <!--  Lighthouse -->
      0 Tag [key=seamark, value=lighthouse]
     1 Tag [key=seamark:light:1:colour, value=white]
     2 Tag [key=seamark:light:1:range, value=20]
     3 Tag [key=seamark:light:1:sequence, value=0.3+(2.7)+0.3+(2.7)+0.3+(8.7)+0.3+(8.7)]
     4 Tag [key=name, value=Leuchtturm Warnemünde]
        <osm-tag key="seamark" value ="lighthouse" zoom-appear="9"/>
       <!-- Sector fires -->
        <osm-tag key="seamark:light:1:sector_end" value="*" renderable = "false" />
        <osm-tag key="seamark:light:1:sector_start" value="*" renderable = "false" />
        <osm-tag key="seamark:light:1:colour" value="white" renderable = "false" />
        <osm-tag key="seamark:light:1:range" value="20" renderable = "false" />
        <osm-tag key="seamark:light:1:sector_end" value="*" renderable = "false" />
        <osm-tag key="seamark:light:1:sector_start" value="*" renderable = "false" />
        <osm-tag key="seamark:light:2:colour" value="white" renderable = "false" />
        <osm-tag key="seamark:light:2:range" value="20" renderable = "false" />
        <osm-tag key="seamark:light:1:sequence" value="0.3+(2.7)+0.3+(2.7)+0.3+(8.7)+0.3+(8.7)" renderable = "false" />

The example is what I could read in the  method in OpenSeamapTestDatabaseRenderer extends DatabaseRenderer :
For each POI there is a call to this routine in the databaserenderer, so I may use it for my own painting.
@Override
    public void renderPointOfInterest(byte layer, int latitude, int longitude, List<Tag> tags) {
        super.renderPointOfInterest(layer, latitude, longitude, tags);
        String tagInfo = "";
        int count = tags.size();
        for (int index= 0;index < count; index++) {
            Tag aTag = tags.get(index);
            tagInfo = tagInfo + index+ " " +aTag.toString() + " ";
        }
        Log.d(TAG,tagInfo);
    }

Something like <osm-tag key="seamark:light:1:sector_start" value="*" renderable = "false" /> does not work.

As the value strings are stored in the header of the .map file it is clear why the can't be wildcards.

So I think about another solution.
Since the number of seamarks in a region is rather small, I plan to keep the information in a stripped copy which contains only seamarks of the osm file.
If I could code the nodenumber to the housenumber which is stored in the map file , I could use the housenumber(nodenumber) to access the right node quickly in th stripped file.
Then I would use the info for my painting on the bitmap of the tile.

How can I strip the osm file  from the other information, so that it contains only the seamarks?
How can I add a additional node information to the osm file like <tag k='house number' v=numberOfTheNode />?

Can this be done with osmosis?


Regards

Victor
      

Will Kamp

unread,
Nov 14, 2012, 3:31:28 PM11/14/12
to mapsfo...@googlegroups.com
Victor,

I'm glad I'm not alone in experiencing the random disappearance of symbols as this was driving me crazy.  I'm eager to find a solution to this as well.  As for sector fires, I think perhaps one option would be to translate the sector fires as ways extending from the light according to the lights distance.  See attached sf3.jpg as en example of a simple raster chart representing a 5nm range light sector.  Also sf1 and sf2 attached show vector charts rendering the same light for comparison.

Will
sf1.jpg
sf2.jpg
sf3.jpg

Will Kamp

unread,
Nov 16, 2012, 1:31:34 PM11/16/12
to mapsfo...@googlegroups.com
After simplifying the rendertheme rules to contain only what I need, the disappearing symbols have stopped for the time being.  On to the next challenge which is multiple (stacked) symbols at the same node location. 

vklein

unread,
Nov 18, 2012, 12:59:10 AM11/18/12
to mapsfo...@googlegroups.com
 I'm very interested which render theme you are using. I saw in you project, that you want to handle  the whole set of symbols. I have no idea how this can be done on mobile device with limited resources.
So I think about prerendering like the mapsforge writer does, this may be a task that is to big for me.
It should be worthy to discuss a concept for this problem. I'm very,very far away from beeing an expert for rendering, so cannot calculate the outlay (Aufwand) to do this and could only collect some ideas to do this.

I had a look on the code of an renderer used in a tile server, its about 5000 lines of c-code.
So there may be a solution to prerender the symbols in a coded form and put them in a structured file like mapsforge , as far as I understood, does.
But I think yours ideas are not to paint direct with graphics commands on the bitmap of a tile but to use high level features of mapsforge ("sector fires as ways extending from the light according to the lights distance")
How do you plan to generate the tags for this?
Maybe we can discuss it per email.

Victor
Reply all
Reply to author
Forward
0 new messages