Updated OsmPlugin (markdown)
parent
0a34edfff1
commit
68488c2c8d
1 changed files with 48 additions and 52 deletions
30
OsmPlugin.md
30
OsmPlugin.md
|
@ -1,10 +1,4 @@
|
||||||
<!-- Name: OsmPlugin -->
|
Mapnik's [[PluginArchitecture]] supports the use of different input formats.
|
||||||
<!-- Version: 27 -->
|
|
||||||
<!-- Last-Modified: 2010/11/13 10:24:18 -->
|
|
||||||
<!-- Author: kunitoki -->
|
|
||||||
|
|
||||||
|
|
||||||
Mapnik's PluginArchitecture supports the use of different input formats.
|
|
||||||
|
|
||||||
This plugin allows for the direct reading of data from the [OpenStreetMap XML format](http://wiki.openstreetmap.org/wiki/.osm). You can use it in two different ways; you can either render a local file, or connect to a URL which provides OSM XML data within a given bounding box.
|
This plugin allows for the direct reading of data from the [OpenStreetMap XML format](http://wiki.openstreetmap.org/wiki/.osm). You can use it in two different ways; you can either render a local file, or connect to a URL which provides OSM XML data within a given bounding box.
|
||||||
|
|
||||||
|
@ -34,8 +28,8 @@ Your layer's Datasource must have a "type" parameter with a value of "osm", in a
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
|
||||||
#!xml
|
```xml
|
||||||
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
|
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
|
||||||
<StyleName>residential</StyleName>
|
<StyleName>residential</StyleName>
|
||||||
<StyleName>unclassified</StyleName>
|
<StyleName>unclassified</StyleName>
|
||||||
<StyleName>secondary</StyleName>
|
<StyleName>secondary</StyleName>
|
||||||
|
@ -45,7 +39,8 @@ For example:
|
||||||
<Parameter name="type">osm</Parameter>
|
<Parameter name="type">osm</Parameter>
|
||||||
<Parameter name="file">test2.osm</Parameter>
|
<Parameter name="file">test2.osm</Parameter>
|
||||||
</Datasource>
|
</Datasource>
|
||||||
</Layer>
|
</Layer>
|
||||||
|
```
|
||||||
|
|
||||||
## Specifying the data's source
|
## Specifying the data's source
|
||||||
|
|
||||||
|
@ -54,8 +49,8 @@ OSM data may be sourced from two different places: a file (as in the example abo
|
||||||
For a web data source, we must provide two parameters: the base URL and the bounding box in WGS84 latitude/longitude. These two parameters are named "url" and "bbox". The full URL of the OSM data server will be constructed from the base URL with the bounding box added as a query string. Here is an example:
|
For a web data source, we must provide two parameters: the base URL and the bounding box in WGS84 latitude/longitude. These two parameters are named "url" and "bbox". The full URL of the OSM data server will be constructed from the base URL with the bounding box added as a query string. Here is an example:
|
||||||
|
|
||||||
|
|
||||||
#!xml
|
```xml
|
||||||
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
|
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
|
||||||
<StyleName>residential</StyleName>
|
<StyleName>residential</StyleName>
|
||||||
<StyleName>unclassified</StyleName>
|
<StyleName>unclassified</StyleName>
|
||||||
<StyleName>secondary</StyleName>
|
<StyleName>secondary</StyleName>
|
||||||
|
@ -66,7 +61,8 @@ For a web data source, we must provide two parameters: the base URL and the boun
|
||||||
<Parameter name="url">http://www.osmdataserver.com/data.php</Parameter>
|
<Parameter name="url">http://www.osmdataserver.com/data.php</Parameter>
|
||||||
<Parameter name="bbox">-0.8,51,-0.7,51.1<Parameter>
|
<Parameter name="bbox">-0.8,51,-0.7,51.1<Parameter>
|
||||||
</Datasource>
|
</Datasource>
|
||||||
</Layer>
|
</Layer>
|
||||||
|
```
|
||||||
|
|
||||||
In the above example, the full URL of the OSM data server would be `http://www.osmdataserver.com/data.php?bbox=-0.8,51,-0.7,51.1`. Data will be downloaded from this URL and rendered according to the rules in the style file.
|
In the above example, the full URL of the OSM data server would be `http://www.osmdataserver.com/data.php?bbox=-0.8,51,-0.7,51.1`. Data will be downloaded from this URL and rendered according to the rules in the style file.
|
||||||
|
|
||||||
|
@ -75,8 +71,8 @@ In the above example, the full URL of the OSM data server would be `http://www.o
|
||||||
Styling the output is done in the same way as for other data sources, with tests for different tags done in the `<Filter>` tag. For example this rule will match OSM ways where the 'highway' tag is equal to 'path' and the 'foot' tag is equal to 'designated':
|
Styling the output is done in the same way as for other data sources, with tests for different tags done in the `<Filter>` tag. For example this rule will match OSM ways where the 'highway' tag is equal to 'path' and the 'foot' tag is equal to 'designated':
|
||||||
|
|
||||||
|
|
||||||
#!xml
|
```xml
|
||||||
<Rule>
|
<Rule>
|
||||||
<Filter>[highway] = 'path' and [foot] = 'designated'</Filter>
|
<Filter>[highway] = 'path' and [foot] = 'designated'</Filter>
|
||||||
<LineSymbolizer>
|
<LineSymbolizer>
|
||||||
<CssParameter name="stroke">#fff</CssParameter>
|
<CssParameter name="stroke">#fff</CssParameter>
|
||||||
|
@ -92,8 +88,8 @@ Styling the output is done in the same way as for other data sources, with tests
|
||||||
<CssParameter name="stroke-linejoin">round</CssParameter>
|
<CssParameter name="stroke-linejoin">round</CssParameter>
|
||||||
<CssParameter name="stroke-linecap">round</CssParameter>
|
<CssParameter name="stroke-linecap">round</CssParameter>
|
||||||
</LineSymbolizer>
|
</LineSymbolizer>
|
||||||
</Rule>
|
</Rule>
|
||||||
|
```
|
||||||
|
|
||||||
## Lines or polygons?
|
## Lines or polygons?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue