Style-File Documentation
From gpsmid
Contents |
Basics
You should probably have run Osm2GpsMid with the default style and used in it on your phone/device. This style-file is inside Osm2GpsMid. Also there's a XML-DTD file (Document Type Definition) named style-file.dtd and describing the XML schema inside Osm2GpsMid. To get them, do the following:
- With an Osm2GpsMid (.xxx.) jar file, rename it as .zip
- From that grab style-file.xml which you will edit, and you may also need to grab style-file.dtd for it to work, put them both in your working folder.
- Your .properties file (which contains the bounding box data) should include a line like such:
style-file = custom-styles.xml
- That means you will have renamed the style-file.xml you grabbed to custom-styles.xml (name is not important).
- You can run the command and it should create a .jar and .jad as normal.
- Now edit custom-styles.xml to how you want, then compile again, hopefully it works the same with no errors.
- Important
- You can also base your work on the style-file.xml contained in high-style.zip. This file contains lots of more POI icons, some sounds and some more way and area descriptions.
- The limit are 128 categories for POIs and Ways (Please confirm!)
Notes
The style sheet is an xml file but attributes of values must be in a certain order. For the ordering see the style-file.dtd. For ways and areas the values inside the keyW tags must be:
- "specialisation*, description, namekey, namefallback?, isArea, scale, textscale?, arrowscale?, descriptionscale?, lineColor, borderColor?, lineStyle?, wayWidth?, searchIcon?, routing*, force_to?, hideable?"
- Items ending with a ? are optional.
- Items ending with a '* are also optional or can occur one or more times.
Attributes common to POIs, ways and areas
I'll try and go through the attributes and notes about what they mean or what you can do with them.
description desc
<description desc = "road"/>
- This appears in brackets after the name of the item if the map is at least once zoomed in from the default zoom level.
- It also shows up when switching on "Alternative information".
- And it is shown in the list of POIs if you use "Nearest POI"-Search.
namekey & namefallback
<namekey tag="name"/>
and
<namefallback tag = "name:en"/>
- Simply the name that will appear on the map and/or the name used for searching
- If the tag given for namekey is not available the value of the namefallback tag will be used as name.
- The namefallback can be used for alternative name
- in regions with foreign language (e.g. in Japan to show romanised names behind Japanese name in Kanji/Kana)
- to show e.g. the cuisine of a restaurant
<value name ="restaurant"> <description desc="Restaurant" /> <image src="restaurant.png" /> <namekey tag="name" /> <namefallback tag="cuisine" /> <scale scale="20" /> <textscale scale="25" /> </value>
- to show the height of a mountain
<value name="peak"> <description desc="Berg" /> <image src="peak.png" /> <namekey tag="name" /> <namefallback tag="ele" /> <scale scale="18" /> <textscale scale="20" /> </value>
- the limit here is the avaiable tags in OSM data
scale
<scale scale="12"/>
- This is the zoom level at which the item will start to show up in the map.
- The more you zoom in the map, the more items are shown,
- the more you zoom out the map, the less.
priority
If this attribute is set, this Way type or POI type will have a lower or higher priority than other Way or POI types. Example for POIs:
<key tag="tourism"> <value name="attraction" priority = "-10"> ...
This will prevent to interpret the POI as an attraction if it also matches a POI description like
<key tag="tourism"> <value name="museum"> ...
Example for ways:
<keyW tag = "highway"> <Wvalue nam="primary" priority "1"> ...
This will prefer to interpret the way as primary highway if it also matches a tram way description like
<key tag="railway"> <Wvalue name = "tram"> ...
specialisation
If this attribute is set also the specialisation condition must match for this way type to be applied. Example:
<keyW tag = "boundary">
<Wvalue name ="administrative" priority "1">
<specialisation key="admin_level" value="2"/>
<description desc = "Country border"/>
...
</Wvalue>
<Wvalue name="administrative" priority "0">
<specialisation key="admin_level" value="6"/>
<description desc = "City border"/>
...
</Wvalue>
</keyW>
If * is specified as value for a specialisation key, this will match only if the specialisation key exists. So only named buildings will be included. Example:
<keyW tag = "building">
<Wvalue name = "yes">
<specialisation key="name" value="*"/>
...
</Wvalue>
</keyW>
It is also possible to negatively match on specialisations e.g. all highway=primary that are not bridge=yes Example:
PLEASE PROVIDE EXAMPLE
hideable
<hideable hideable="false"/>
If set to false this area, way or POI type will not be hidden when unselecting Areas or POIs in the Map features Dialog. Also it will not be available in the Show/Overview Map dialog.
POI Attributes
These attributes can only be under a key/value that is in <pois>
image
For POIs:
<image src="restaurant.png"/>
- If you just put the file (with no /) it will pick up the image from your working directory or its png-subdirectory and bundle it into the jar (no need to copy the image file to your device).
- This will be shown in the map and in the Search gui if no special searchIcon is given.
searchIcon
For POIs:
<searchIcon src = "city.png"/>
- If you just put the file (with no /) it will pick up the image from your working directory or its png-subdirectory and bundle it into the jar (no need to copy the image file to your device).
- The image will appear on the left of the name in searching if no image tag is given.
Way and Area Attributes
These attributes can only be under a key/value that is in <ways>
isArea
For ways:
<isArea area = "false"/>
- States if this is a line (false) or if it is an area (true)
- If an area then it will get filled even if the way doesn't join up to it's self
- the direct route from the end of the way back to the start of the way will be found to close the way as an area
lineColor
For ways:
<lineColor color = "00809BC0" colorAtNight="00800080" />
- The fill colour of the line or area
- It is like an html hex code with 2 extra digits (for transparency). It's 00RRGGBB with RR, GG and BB being hexdigits from 00 to FF.
- the colorAtNight= is optional (exists only in version CVS 0.5.09).
borderColor
<borderColor color="00000000" colorAtNight="00FF0000" />
- See line colour, but for the border of the way/area
- Optional
lineStyle
<lineStyle dashed="true" />
- possible values: dashed in DTD
- values dotted, solid also possible?
- Optional
wayWidth
For ways:
<wayWidth width="8" />
- The width of the non-area way?
- What is the measurement?
arrowscale
For ways only:
<arrowscale scale="25"/>
- This is the zoom level at which arrows for oneways will start to show up in the map.(automatic default is, if way gets wide enough)
descriptionscale
For areas only:
<descriptionscale scale="25"/>
- This is the zoom level at which description for areas will also show up in the map.
- automatic default is scale alias 23
routing
For non-area ways:
<routing with="motorcar" accessible="true" speed="120" />
In the with parameter you specify for which transport medium this accessibility definition is. Up to version 0.5.0 only one transport medium from the style-file will be included in a midlet, but you can add multiple routing tags for each way in the style-file. You chose which one is applied to your midlet, e.g. motorcar routing, by setting in your .properties file the useRouting parameter, e.g.:
useRouting=motorcar
From CVS version 0.5.09 it is possible to use more than one transport medium. The .properties file must than include a line like
useRouting=motorcar,bicycle,foot
If accessible is set to true then this way will be included for finding routes for the given transport medium. If the way is not accessible for routing, set it to false or leave out the whole tag. If the way type might become routable when additional tags like
motorcar=designated
are contained in the way, define it anyway with
accessible="false"
and a given speed, as this will be used when the way should become routable by a match in the routeAccessRestrictions.
The speed is relative to other ways in km/h, ways with higher speeds will be chosen over lower speed ways.
forceTo
<force_to layer="-2" />
This forces the layer of this way type to a certain value. I.e. you can force "leisure=park" to layer -2 so this area type will not cover footways within.
routeAccessRestrictions
Osm2GpsMid will check ways for route access restrictions specified for the entry "useRouting" in the properties file e.g.
useRouting="motorcar"
or
useRouting="bicycle"
If restrictionPermit is missing or false, ways having tags matching the restrictionKey and restrictionValues are accessible for routing. If restrictionPermit is true, ways having tags matching the restrictionKey and restrictionValues are accessible for routing.
- Example
<routeAccessRestrictions for = "motorcar"> <routeAccessRestriction restrictionKey="motorcar" restrictionValues="yes|designated" restrictionPermit = "true"/> <routeAccessRestriction restrictionKey="motorcar" restrictionValues="no|private"/> <routeAccessRestriction restrictionKey="access" restrictionValues="no|private"/> <routeAccessRestriction restrictionKey="vehicle" restrictionValues="no|private"/> </routeAccessRestrictions>
Created Styles
Does anybody have style sheets they've created? Please upload them to the Style File Gallery
