
Hi, I can provide a patch to mkgmap for this problem. I just forgot to publish it but remembered when I saw your topic. I called it multi tag patch. It just duplicates POIs for points that match more then one rule. It also should work with tags like this: amenity=fuel;post_office. Tested with my nuvi 360. Please let me know if it works for you. To apply the patch us the following commands: cd mkgmap patch -p 0 < /tmp/mkgamp-multitags-R988.patch Thanks Berni. Marko Mäkelä schrieb:
On Wed, Apr 01, 2009 at 06:20:31PM +0200, Torsten Leistikow wrote:
Marko Mäkelä schrieb:
You can always define separate points for the hotel and the restaurant.
Can you do this with mkgmap when you only have one OSM-node? This is rather often the case, like the example with the hotel and the restaurant, or you often find a combination of a restaurant with a castle, windmill or watermill.
I'm an OSM newbie, and the only bits of mkgmap I have studied so far are the style files. There are limitations in the way how tags are assigned in OSM too. For example, a fuel station that also acts as a post office can't be declared both amenity=fuel and amenity=post_office, because key names must be unique. Two separate nodes would be needed, or the tagging would have to change to something like amenity:fuel=Shell, amenity:post_office=01480 Vantaa. I think it'd be clearer to have two separate nodes at least in this case.
What I would like ot have, is the possibility, to set in the style, whether a certain element shall be used exclusivly or whether the creation of another garmin map item from the same OSM element shall be allowed.
For nodes, that could be useful in some cases.
The usability of such a feature wouldn't be limited to points. If you have a street with an access restriction, you could draw the street normally as the first line and add the restriction as a second line. The benefit of this approach would be, that you only need one extra line type to draw the restrictions for all existing road types.
Would that break routing? What kind of restrictions do you have in mind? As far as I understand, oneway=yes/no is a line property in the Garmin format. Possibly likewise for the speed limit. Access to footways and cycleways is restricted from powered vehicles, but you surely don't suggest that all footways and cycleways be drawn twice.
Marko _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: src/uk/me/parabola/mkgmap/osmstyle/SequenceRule.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/SequenceRule.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/SequenceRule.java (working copy) @@ -42,6 +42,11 @@ } return null; } + + public List<GType> resolveTypes(Element el) + { + return null; + } /** * Add a rule to this sequence. We do a quick check for impossible Index: src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/ActionRule.java (working copy) @@ -61,6 +61,11 @@ } return null; } + + public List<GType> resolveTypes(Element el) + { + return null; + } public String toString() { StringBuilder fmt = new StringBuilder(); Index: src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/RuleSet.java (working copy) @@ -18,8 +18,10 @@ import java.util.Formatter; import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Vector; import uk.me.parabola.mkgmap.reader.osm.Element; import uk.me.parabola.mkgmap.reader.osm.GType; @@ -79,6 +81,36 @@ return foundType; } + public List<GType> resolveTypes(Element el) { + List<GType> foundTypes = null; + for (String tagKeys : el) { + + String keyValue[] = tagKeys.split("="); + + if(keyValue != null && keyValue.length > 1 && keyValue[1] != null) + { + String values[] = keyValue[1].split(";"); + + for(int i = 0; i < values.length ;i++) + { + String tagKey = keyValue[0].concat("=").concat(values[i]); + + Rule rule = rules.get(tagKey); + if (rule != null) { + GType type = rule.resolveType(el); + if(type != null) + { + if(foundTypes == null) + foundTypes = new Vector<GType>(); + foundTypes.add(type); + } + } + } + } + } + return foundTypes; + } + public void addAll(RuleSet rs) { for (Map.Entry<String, Rule> ent : rs.entrySet()) add(ent.getKey(), ent.getValue()); Index: src/uk/me/parabola/mkgmap/osmstyle/FixedRule.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/FixedRule.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/FixedRule.java (working copy) @@ -16,6 +16,8 @@ */ package uk.me.parabola.mkgmap.osmstyle; +import java.util.List; + import uk.me.parabola.mkgmap.reader.osm.Element; import uk.me.parabola.mkgmap.reader.osm.GType; import uk.me.parabola.mkgmap.reader.osm.Rule; @@ -35,6 +37,11 @@ public GType resolveType(Element el) { return gtype; } + + public List<GType> resolveTypes(Element el) + { + return null; + } public String toString() { return gtype.toString(); Index: src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/ExpressionRule.java (working copy) @@ -16,6 +16,8 @@ */ package uk.me.parabola.mkgmap.osmstyle; +import java.util.List; + import uk.me.parabola.mkgmap.osmstyle.eval.Op; import uk.me.parabola.mkgmap.reader.osm.Element; import uk.me.parabola.mkgmap.reader.osm.GType; @@ -42,6 +44,11 @@ return null; } + + public List<GType> resolveTypes(Element el) + { + return null; + } public String toString() { return exression.toString() + ' ' + gtype; Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision 339) +++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (working copy) @@ -179,21 +179,25 @@ public void convertNode(Node node) { preConvertRules(node); - GType foundType = nodeRules.resolveType(node); - if (foundType == null) + List<GType> foundTypes = nodeRules.resolveTypes(node); + if (foundTypes == null) return; + + for(int i=0; i < foundTypes.size(); i++) + { + GType foundType = foundTypes.get(i); + + // If the node does not have a name, then set the name from this + // type rule. + log.debug("node name", node.getName()); + if (node.getName() == null) { + node.setName(foundType.getDefaultName()); + log.debug("after set", node.getName()); + } - // If the node does not have a name, then set the name from this - // type rule. - log.debug("node name", node.getName()); - if (node.getName() == null) { - node.setName(foundType.getDefaultName()); - log.debug("after set", node.getName()); + postConvertRules(node, foundType); + addPoint(node, foundType); } - - postConvertRules(node, foundType); - - addPoint(node, foundType); } /** Index: src/uk/me/parabola/mkgmap/reader/osm/Rule.java =================================================================== --- src/uk/me/parabola/mkgmap/reader/osm/Rule.java (revision 339) +++ src/uk/me/parabola/mkgmap/reader/osm/Rule.java (working copy) @@ -16,6 +16,8 @@ */ package uk.me.parabola.mkgmap.reader.osm; +import java.util.List; + /** * A rule takes an element and returns the correct garmin type for it. * Immplementations can be simple or complex as needed. @@ -32,4 +34,5 @@ * @return Enough information to represent this as a garmin type. */ public GType resolveType(Element el); + public List<GType> resolveTypes(Element el); }