GpsMid/StyleSheet

From OpenStreetMap Wiki
Jump to navigation Jump to search

I wanted to use GPSMid for a specific area(very custom tags), and it would be good generally to make different GPSMid maps, but there seems to be no stylesheet documentation. Here's my attempt to create some documentation or to leave a list of questions for the developer to answer.

Thank you for this page! I've just copied this information over to http://sourceforge.net/apps/mediawiki/gpsmid/index.php?title=Style-File_Documentation. Can we continue there?

Some of this information is from http://gpsmid.sourceforge.net/osmtogpsmid.html which includes a sample style sheet.

Basics

You should probably have run Osm2GpsMid with the default style and used it on your phone/device. Your working file is the one with Osm2GpsMid.jar, the .osm file, the .properties file and where your compiled .jad and .jar will be.

  • 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 of 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.

Notes

The style sheet is an xml file but attributes of values must be in a certain order.

description, namekey, namefallback?, isArea, scale, textscale?, lineColor, borderColor?, lineStyle?, wayWidth?, searchIcon?, routing?, force_to?
Items ending with a ? are optional.


General Attributes

I'll try and go through the attributes and notes about what they mean or what you can do with them.

pois, ways

<pois></pois> or <ways></ways>

File is divided on just these two basic sections. Pois are point objects, ways are linear objects. Aerials object are also in <ways> section. The only diffrence is atibute isArea. False for ways, true for aeras

key keyW

<key tag = "place"></key> or <keyW tag = "highway"></keyW>

key for <pois>, keyW for <ways>.
This is primary keyword for your object to be modeled. So if you want to include some new object or change some existing you need to start new <key> or <keyW> tag or use existing section of <key>, <keyW>.
It is just a name of tag available for the object under consideration. Not a value of this tag. OSM file is actually xml file and objects usually have many tags. You can pick probably any of them if it exists for your object.(but i have some problems with tag "name" and some others specific tags so I'm not sure). In many cases it is more benefical to use existing section (but sometimes not possible).


value Wvalue

<value name="city"></value> or <Wvalue name = "cycleway" priority = "8"></Wvalue>

value for <pois>, Wvalue for <ways>
Values of keytag for your object. It can come with priority (optional) parameter which shows (in a case when object belong to two different groups) which choice is more important. The object for example is a "cycleway" under keytag "highway", but in this same time it is "yes" under keytag "marked_trail_red". The biger priority parameter shows what is more important and, as a consequence, how object will be treated. If priorities are identical first in the file is probably taken (my experience):
Between the <value> or <Wvalue> markups the further more specific paramteres like styling and routing are specyfied
To show all kinds of a name use name="*" . Example: to show all barriers:
<keyW tag="barrier">
<Wvalue name="*">
<description desc="Barriere"></description>
<namekey tag="name"></namekey>
<isArea area="false"></isArea>
<scale scale="20"></scale>
<lineColor color="00000000" colorAtNight="00FFEE00"></lineColor>
<lineStyle dashed="true"></lineStyle>
<wayWidth width="1"></wayWidth>
</Wvalue>
</keyW>

specialization

<specialisation key="highway" value="cycleway"/>

Optional parameter.
Secondary keyword of choice. If the choice by keytag value reults in choosing two groups of object, you can still pick one if some other tag for these groups is diffrent. This tag and values of it goes to specialization.
Example:
<keyW=somekeyW>
<Wvalue=someWvalue>
<specialisation key="somedifferentkeyW" value="one"/>
some styling
</Wvalue>
<Wvalue=someWvalue
<specialisation key="somedifferentkeyW" value="two"/>
some other styling
</Wvalue>
</keyW>

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 keytag name where the name of the object is stored. The value of this keytag will appear on the map and/or will be used for searching
If the tag given for namekey is not available the value of the namefallback tag will be used as name.

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.

forceTo

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.

POI Attributes

These attributes can only be under a key/value that is in <pois>

image

<image src="restaurant.png"/> (for pois)

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

<searchIcon src = "city.png"/> (for pois)

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 Attributes

These attributes can only be under a key/value that is in <ways>

isArea

<isArea area = "false"/> (for ways)

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

<lineColor color = "00809BC0" /> (for ways)

The fill colour of the line or area
How is the colour made up? It looks like an html hex code with 2 extra digits. 2 for transparency?

I think it's 00RRGGBB with RR, GG and BB being hexdigits from 00 to FF.

borderColor

See line colour, but for the border of the way/area
Optional

lineStyle

Dashed
Dotted not supported (at least in java applets)
Actually dashed is also not supported. I can be set, but it can not be displayed (AFAIK at least in java applets)
Optional

wayWidth

<wayWidth width="8" /> (for ways)

The width of the non-area way?
What is the measurement?

routing

<routing accessible="true" speed="120" /> (for non-area ways)

If true then it will be included in making routes across the map
If false then you can leave out the whole tag
The speed is relative to other ways, ways with higher speeds will be chosen over lower speed ways

You can specify different speeds for different trafic. For exampe in the primary roads block:

<routing with="motorcar" accessible="true" speed="80"></routing>

<routing with="bicycle" accessible="true" speed="10"></routing>

<routing with="foot" accessible="true" speed="4"></routing>     

Routes

Routes are a special case of ways. For example a bus route drawn as thin light blue line on all streets that it is running along:

<keyW tag="route">

<Wvalue name="bus" priority="19">

<description desc="Bus line"></description>

<asRelation relation="true" combined="true"></asRelation>

<namekey tag="ref"></namekey>

<isArea area="false"></isArea>

<scale scale="20"></scale>

<lineColor color="0000FFFF"></lineColor>

<wayWidth width="1"></wayWidth>

<force_to layer="2"></force_to>

</Wvalue>

</keyW>

Created Styles

Does anybody have style sheets they've created? Please link to them here.

There's a high-style.zip available for download: http://sourceforge.net/project/showfiles.php?group_id=192084 It contains many additional ways, areas and icons.