Man page of SMFILTER
Section: SMfilter User's Manual (1)
Return to Main Contents
smfilter - Seamark filter reads an OSM/XML file and preprocesses nodes with the tag 'seamark:type=*'.
smfilter is a tool which is part of the OpenSeamap rendering process. It is a
preprocessor run before the actual task of rendering. smfilter reads an OSM
file from stdin, processes sectored lights, and outputs the result in OSM
format to stdout again. The output contains all the input data plus additional
nodes, ways and tags which are generated for the sectors of lights. This
simplifies the rendering process and reduces data within the OSM database.
smfilter is written in C and is based on libhpxml which is included in the package. Libhpxml
is a high preformance XML stream parsing library. Thus, smfilter is suitable
to parse huge OSM files, for example the planet file ;).
Sectors of lights are defined by several tags. This is defined in the
OpenSeamap lights data model. Start and end of sectors are defined by
seamark:light:#:sector_start=* and seamark:light:#:sector_end=*. The values are
given in degrees from 0° to 360°. Please note that these are bearings from
observer to the light which means that they are rotated by 180 degrees. This
definition is common to mariners. smfilter reads and parses this sector data
and adds two radial ways and the sector arc in form of OSM nodes and ways to
the OSM file. This can then be simply rendered by the renderer through applying
style sheets to these ways.
The radial ways and arcs are tagged with information required by the renderer
to complete the process.
The tags for the radial ways are seamark:light_radial=<n> and seamark:light:object=<type>
being n the number of the sector and type the type of the light as defined by
the seamark:type=<type> of the seamark node.
The arc ways are tagged with seamark:light:sector_nr=<n>, seamark:light:object=<type>,
and seamark:arc_style=<style>; style is one of "solid", "suppress", "dashed",
"taper_1", "taper_2", "taper_3", "taper_4", "taper_5", "taper_6", or "taper_7".
The default of smfilter is to choose "solid". The behavior of smfilter can
be influenced by the map editor with the tag seamark:light:#:radius=* (see below).
Note that these ways and their tags form private,
virtual data and are not used within the OSM database. They only have a
transient existence, between the output of smfilter and the input of
seamark:light:#:radius=* (see OSM-Wiki:Rendering Sector Arcs) is an optional tag for
influencing the behavior of smfilter. It defines the radius of the sector and
other information to change rendering on the map. Please note that this does
not have any relevance for navigation.
The value of seamark:light:#:radius=* is defined as follows:
- seamark:light:#:radius = <arcdef>[;<arcdef>][;...]
- <arcdef> ::= [<radius>][:<secdef>]
- <secdef> ::= <segment>[:<style>] | <style>[:<segment>]
- <radius> ::= Radius in nautical miles.
- <segment> ::= Angle of the arc segment in degrees relative to sector_start.
- <style> ::= 'solid' | 'dashed' | 'suppress' | 'taper_up' | 'taper_down'
<segment> may also be given as a negative number. In that case it is measured
backwards starting at sector_end. This is only valid if it is used in the last
<arcdef>. If just a single <arcdef> is defined, a virtual solid arc segment is
inserted before (see sector 3 of example below).
<radius> and <segment> must be any sole fractional number without units (they
would simply be ignored). Negative values of <radius> would result in a default
value being used.
If the sum of angles of all segments is not equal to the range of the sector,
smfilter will squeeze or enlarge them to fit the actual range of the sector
(see sector 2 of example below). There is always is a mapping error and will
probably result in a rendering which was not desired by the mapper. In case of
using a negative value for <segment> in the last <arcdef>, smfilter will
stretch the previous <arcdef> appropriately, if it does not have a <segment>
defined (see sectors 1 and 5 of example below).
EXAMPLE OF LIGHT DEFINITION
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.6' generator='Bernhard R. Fischer'>
<node id='1' version='1' visible='true' timestamp='2008-07-25T11:12:13Z' lat='38.3' lon='25.1'>
<tag k='seamark:name' v='smfilter test object' />
<tag k='seamark:type' v='light_minor' />
<tag k='seamark:light:character' v='Fl' />
<tag k='seamark:light:period' v='8' />
<tag k='seamark:light:orientation' v='230' />
<tag k='seamark:light:category' v='directional' />
<tag k='seamark:light:radius' v='1.2' />
<tag k='seamark:light:1:sector_start' v='40'/>
<tag k='seamark:light:1:sector_end' v='70'/>
<tag k='seamark:light:1:colour' v='white'/>
<tag k='seamark:light:1:radius' v='1:10;:dashed;:solid:-10'/>
<tag k='seamark:light:2:sector_start' v='120'/>
<tag k='seamark:light:2:sector_end' v='190'/>
<tag k='seamark:light:2:colour' v='red'/>
<tag k='seamark:light:2:radius' v='.5:20;:10:suppress;:10:dashed;0.7:10:solid'/>
<tag k='seamark:light:3:sector_start' v='300'/>
<tag k='seamark:light:3:sector_end' v='20'/>
<tag k='seamark:light:3:colour' v='green'/>
<tag k='seamark:light:3:radius' v='.3:-25:suppress'/>
<tag k='seamark:light:4:sector_start' v='25'/>
<tag k='seamark:light:4:sector_end' v='35'/>
<tag k='seamark:light:4:colour' v='red'/>
<tag k='seamark:light:4:radius' v='1.5'/>
<tag k='seamark:light:5:sector_start' v='250'/>
<tag k='seamark:light:5:sector_end' v='300'/>
<tag k='seamark:light:5:colour' v='red'/>
<tag k='seamark:light:5:radius' v='1:15:taper_up;:solid;:-15:taper_down'/>
- -a dist
This sets the maximum distance of arc nodes. Basically, the distance is scaled with
the radius; the smaller the radius the smaller the distance and vice versa. With
large radii the distance of nodes is limited to dist. The value is given in
- -b deg
Leading and directional lights are rendered with a bearing line and a small arc at its end.
deg sets the angle of this arc to one side which means it is drawn def
degrees clockwise and def degress counterclockwise from the bearing line.
- -d div
This defines the arc divisor which is used to determine the distance of the arc nodes.
Thus, the node distance equals the radius divided by div. (see also option -a).
Display short usage message and shows options.
In the past, the OpenSeamap lights data model used a special tag to give a hint to the renderer in
the format seamark:light:#=<col>:<start>:<end>:<r>. This optional enables
smfilter to parse this tag also. Please note that this tag is deprecated, hence,
smfilter ignores it by default.
- -l logfile
smfilter may encouter some errors during the parsing process. Such errors are output
to the file named logfile.
- -r radius
I light may not have any radius specified since the tag is optional. In such cases smfilter
picks radius as default value.
This man page is still not finished...
Concepts, software, and man page written by Bernhard R. Fischer,
smfilter project page
libhpxml project page
OpenSeamap project page
OpenSeamap lights data model
Copyright 2011 Bernhard R. Fischer, 2048R/5C5FFD47 <email@example.com>
Smfilter is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
Smfilter is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with smfilter. If not, see <http://www.gnu.org/licenses/>.
- RADIUS TAG
- EXAMPLE OF LIGHT DEFINITION
- SEE ALSO
This document was created by
using the manual pages.
Time: 18:36:16 GMT, September 09, 2011