logo separator

[mkgmap-dev] Relations and Multiple Tag Parsing Style Rules

From f.hartmann felixhartmann at fh-krems.eu on Tue Dec 2 21:49:53 GMT 2008

2. Yes exactly as you understood it. That would be really practical. Here you can see some screenshots how such maps could look like: http://wiki.openstreetmap.org/index.php/OSM_Map_On_Garmin/mtb_map
This was done using osm_composer (OSM_Composer did exactly that, upon matching rules create a copy of a polyline (of course there needs to be a NEW unique way id (easiest just add a number like 1000, 1001, 1002, 1003, etc based on rule to the old way id.), but delete all other tags except the one searched for of the polyline, leaving the original polyline without change. Now mkgmap would effectively read the same line two times, but due to different tags one could now render much better looking maps.

The problem is that OSM_Composer is a bit buggy and doesn't work for larger areas. User Nop hasn't updated OSM_Composer for some time, and in current state it is not really usable (it simply forgets some rules). Nop said that he wanted to completely rewrite the program to get rid of several bugs and increase performance (and lower the enormous memory demands) but since 3 weeks he has not shown any sign of life. If mkgmap could implement that instead it would be a lot easier.

1: Following my example lines stye-file (mkgmap compiled from SVN this midday):
type = route & route=bicycle
        {all add route=bicylcle }
route=bicycle [0x0e resolution 8]
relation:route=bicycle [0x01 resolution 10]
network=ncn [0x02 resolution 10]
network=rcn [0x03 resolution 10]
network=lcn [0x04 resolution 10]

D:\Garmin\mkgmap_680>java -jar -Xmx1256M mkgmap.jar --description=Osm_Mtb_Austria --family-id=4011 --style-file=standard --product-id=1 --gmapsupp --levels=0:24,1:22,2:20,3:18,4:16,5:14,6:12,7:10 --area-name=austria austria.osm
Exception in thread "main" uk.me.parabola.mkgmap.osmstyle.eval.SyntaxException: Error: (lines:2): Unrecognised command 'all'
        at uk.me.parabola.mkgmap.osmstyle.actions.ActionReader.readActions(ActionReader.java:69)
        at uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:89)
        at uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:73)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readRules(StyleImpl.java:180)
        at uk.me.parabola.mkgmap.osmstyle.StyleImpl.<init>(StyleImpl.java:122)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.createStyler(Osm5MapDataSource.java:110)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:70)
        at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:125)
        at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:44)
        at uk.me.parabola.mkgmap.main.Main.processFilename(Main.java:145)
        at uk.me.parabola.mkgmap.CommandArgs$Filename.processArg(CommandArgs.java:355)
        at uk.me.parabola.mkgmap.CommandArgs.readArgs(CommandArgs.java:114)
        at uk.me.parabola.mkgmap.main.Main.main(Main.java:90)

After Deleting all - new code in lines is the following:
type = route & route=bicycle
        {add route=bicylcle }
route=bicycle [0x0e resolution 8]
relation:route=bicycle [0x01 resolution 10]
network=ncn [0x02 resolution 10]
network=rcn [0x03 resolution 10]
network=lcn [0x04 resolution 10]
I get the following error:
D:\Garmin\mkgmap_680>java -jar -Xmx1256M mkgmap.jar --description=Osm_Mtb_Austria --family-id=4011 --style-file=standard --product-id=1 --gmapsupp --levels=0:24,1:22,2:20,3:18,4:16,5:14,6:12,7:10 --area-name=austria austria.osm
Exception in thread "main" java.lang.NullPointerException
        at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:91)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler.endDocument(Osm5XmlHandler.java:263)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at javax.xml.parsers.SAXParser.parse(Unknown Source)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:71)
        at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:125)
        at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:44)
        at uk.me.parabola.mkgmap.main.Main.processFilename(Main.java:145)
        at uk.me.parabola.mkgmap.CommandArgs$Filename.processArg(CommandArgs.java:355)
        at uk.me.parabola.mkgmap.CommandArgs.readArgs(CommandArgs.java:114)
        at uk.me.parabola.mkgmap.main.Main.main(Main.java:90)

Yours, Felix
Steve Ratcliffe wrote:

On Tue, Dec 02, 2008 at 01:25:00PM +0100, f.hartmann wrote:
> 1. Is there any possibility to give a different tag to relations?

Tell me if this works.

My plan for relations, is that there is a rule file for relations
that is run before any of the others.

The rules match the tags on the relation, and you can set up
actions to run when the rule matches.  This action will be able to
add tags to each of the ways making up the relation.
You can then match those tags in the normal lines rule file.

Eg something like this:

type = route & route=bicycle
        { all add route=bicylcle }

This will add the tag route=bicycle on each way in the relation.
You can add more than one tag and also you can use the values
of tags on the relation.

Something like this:

type = route & rcn=* { all add cycle_ref="${ref}" }

(sorry probably not a very good example).


> 2.  Could Multiple Tag parsing be implemented into the style rules somehow?

> Solution: If a way has two tags that are listed in the style file, both
> should be included seperately into the image. By using a .typ file one

Let me see if I understand what you are suggesting.

You want a rule match to cause a copy of the line to be created with a
given type and then allow the line to be subject to further matches in the
rules?  The final result would be a map that contains the same line several
times with a different type?

If so, that may be possible.

..Steve
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

________________________________
Diese Nachricht erhalten Sie von einem Studierenden der IMC Fachhochschule Krems. Für Übermittlungsfehler oder sonstige Irrtümer bei Übermittlung besteht keine Haftung seitens der IMC Fachhochschule Krems.

This message is being transmitted by an IMC student. The sender does not accept liability for any errors or omissions as a result of the transmission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20081202/2212c3d0/attachment.html 


More information about the mkgmap-dev mailing list