Fixed for unicode change post 0.5

This commit is contained in:
Nick Whitelegg 2008-03-06 21:04:47 +00:00
parent b117de1bdb
commit 0dafa5eae3
7 changed files with 1129 additions and 7 deletions

View file

@ -27,6 +27,7 @@
#include <mapnik/query.hpp>
#include "osm_datasource.hpp"
#include "osm_featureset.hpp"
#include "osmtagtypes.h"
#include <set>
DATASOURCE_PLUGIN(osm_datasource)
@ -52,9 +53,14 @@ osm_datasource::osm_datasource(const parameters &params)
// load the data
if (osm_data_->load(osm_filename.c_str(),parser)==false)
{
throw datasource_exception("Error loading OSM data");
//throw datasource_exception("Error loading OSM data");
return ;
}
osm_tag_types tagtypes;
tagtypes.add_type("maxspeed",mapnik::Integer);
tagtypes.add_type("z_order",mapnik::Integer);
osm_data_->rewind();
// Need code to get the attributes of all the data
std::set<std::string> keys= osm_data_->get_keys();
@ -62,7 +68,7 @@ osm_datasource::osm_datasource(const parameters &params)
// Add the attributes to the datasource descriptor - assume they're
// all of type String
for(std::set<std::string>::iterator i=keys.begin(); i!=keys.end(); i++)
desc_.add_descriptor(attribute_descriptor(*i,String));
desc_.add_descriptor(attribute_descriptor(*i,tagtypes.get_type(*i)));
// Get the bounds of the data and set extent_ accordingly
bounds b = osm_data_->get_bounds();

View file

@ -118,7 +118,7 @@ feature_ptr osm_featureset<filterT>::next()
{
//only add if in the specified set of attribute names
if(attribute_names_.find(i->first) != attribute_names_.end())
(*feature)[i->first] = tr_->transcode(i->second);
(*feature)[i->first] = tr_->transcode(i->second.c_str());
i++;
}
return feature;

View file

@ -71,6 +71,8 @@ void osmparser::startElement(xmlTextReaderPtr reader, const xmlChar *name)
assert(xid);
way->id = atol((char*)xid);
cur_item = way;
// Prevent ways with no name being assigned a name of "0"
cur_item->keyvals["name"] = "";
xmlFree(xid);
}
else if (xmlStrEqual(name,BAD_CAST "nd"))

View file

@ -0,0 +1,28 @@
#ifndef OSMTAGTYPES_H
#define OSMTAGTYPES_H
// osmtagtypes.h
// for finding the types of particular tags
#include <mapnik/feature_layer_desc.hpp>
class osm_tag_types
{
private:
std::map<std::string,mapnik::eAttributeType> types;
public:
void add_type(std::string tag, mapnik::eAttributeType type)
{
types[tag]=type;
}
mapnik::eAttributeType get_type(std::string tag)
{
std::map<std::string,mapnik::eAttributeType>::iterator i =
types.find(tag);
return (i==types.end()) ? mapnik::String: i->second;
}
};
#endif // OSMTAGTYPES_H

View file

@ -15,17 +15,34 @@ using namespace mapnik;
using namespace std;
int main()
int main(int argc,char *argv[])
{
if(argc < 6)
{
std::cerr<<"Usage: render XMLfile w s e n OSMfile" << std::endl;
exit(0);
}
datasource_cache::instance()->register_datasources
("/usr/local/lib/mapnik/input");
freetype_engine::register_font
("/usr/local/lib/mapnik/fonts/Vera.ttf");
("/usr/local/lib/mapnik/fonts/DejaVuSans.ttf");
Map m (800,800);
load_map(m,"test.xml");
load_map(m,argv[1]);
Envelope<double> bbox (-1.45,50.90,-1.35,51.00);
parameters p;
p["type"] = "osm";
p["file"] = argv[6];
for(int count=0; count<m.layerCount(); count++)
{
parameters q = m.getLayer(count).datasource()->params();
m.getLayer(count).set_datasource(datasource_cache::instance()->
create(p));
}
Envelope<double> bbox (atof(argv[2]),atof(argv[3]),
atof(argv[4]),atof(argv[5]));
m.zoomToBox(bbox);

538
plugins/input/osm/test2.xml Normal file
View file

@ -0,0 +1,538 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="#d0d0d0" srs="+proj=latlong +datum=WGS84">
<Style name="amenity">
<Rule>
<Filter>[amenity]='pub'</Filter>
<PointSymbolizer file="/home/nick/images/pub.png" type="png"
width="16" height="16" />
</Rule>
<Rule>
<Filter>[man_made]='mast'</Filter>
<PointSymbolizer file="/home/nick/images/mast.png" type="png"
width="16" height="16" />
</Rule>
<Rule>
<Filter>[amenity]='parking'</Filter>
<PointSymbolizer file="/home/nick/images/carpark.png" type="png"
width="16" height="16"/>
</Rule>
<Rule>
<Filter>[residence]='farm'</Filter>
<PointSymbolizer file="/home/nick/images/farm.png" type="png"
width="16" height="16"/>
</Rule>
</Style>
<Style name="leisure">
<Rule>
<Filter>[landuse] = 'reservoir'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#89bac6</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[landuse] = 'cemetery'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">grey</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[landuse] = 'wood' or [landuse] = 'forest'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#aed1a0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[leisure] = 'park' or [leisure] = 'common' or
[leisure] = 'golf_course'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#d8e8d0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[natural] = 'wood'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#aed1a0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[natural] = 'heath'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#ffe0c0</CssParameter>
</PolygonSymbolizer>
</Rule>
</Style>
<Style name='lakes'>
<Rule>
<Filter>[natural] = 'water'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#89bac6</CssParameter>
</PolygonSymbolizer>
</Rule>
</Style>
<Style name="text">
<Rule>
<Filter>[place] = 'city'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="16" fill="#000" halo_radius="2" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[place] = 'town'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="14" fill="#000" halo_radius="2" wrap_width="20"/>
</Rule>
<Rule>
<Filter>[place] = 'village' or [place] = 'suburb'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="13" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[place] = 'hamlet'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="12" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[natural] = 'peak'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="11" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[natural] = 'wood' or [natural] = 'water' or [natural] = 'heath'
or [leisure] = 'golf_course' </Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book"
size="10" fill="#000" halo_radius="2" wrap_width="0" />
</Rule>
</Style>
<Style name="river">
<Rule>
<Filter>[waterway] = 'river'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#89bac6</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="9" fill="white" placement="line"/>
</Rule>
</Style>
<Style name="stream">
<Rule>
<Filter>[waterway] = 'stream'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#89bac6</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="9" fill="white" placement="line"/>
</Rule>
</Style>
<Style name="roads-casing">
<Rule>
<Filter>[highway] = 'motorway' or [highway]='motorway_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#506077</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'trunk' or [highway] = 'trunk_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#477147</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'primary' or [highway] = 'primary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#8d4346</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'secondary' or [highway] = 'secondary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#a37b48</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'tertiary' or [highway] = 'tertiary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'minor' or [highway] = 'unclassified'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'residential' or [highway] = 'service'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'unsurfaced' or [highway] = 'track'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="motorway">
<Rule>
<Filter>[highway] = 'motorway' or [highway] = 'motorway_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#809bc0</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="trunk">
<Rule>
<Filter>[highway] = 'trunk' or [highway] = 'trunk_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#7fc97f</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="primary">
<Rule>
<Filter>[highway] = 'primary' or [highway] = 'primary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#e46d71</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="secondary">
<Rule>
<Filter>[highway] = 'secondary' or [highway] = 'secondary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fdbf6f</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="tertiary">
<Rule>
<Filter>[highway] = 'tertiary' or [highway] = 'tertiary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#ffffc0</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="unclassified">
<Rule>
<Filter>[highway] = 'minor' or [highway] = 'unclassified'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="residential">
<Rule>
<Filter>[highway] = 'residential' or [highway] = 'service' or
[highway] = 'unsurfaced' or [highway] = 'track'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="bridleway">
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = ''</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">magenta</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [foot] = 'yes' and [horse] = 'yes'
and [bicycle] = 'yes'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'narrow'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#00c000</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
<CssParameter name="stroke-dasharray">1,5</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'path'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">#00c000</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">2,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'gravel'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">brown</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'track'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">brown</CssParameter>
<CssParameter name="stroke-dasharray">2,4</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="footway">
<Rule>
<Filter>[highway] = 'footway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">magenta</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">1,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'footway' and [foot] = 'yes'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">1,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="cycleway">
<Rule>
<Filter>[highway] = 'cycleway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">blue</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">4,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="byway">
<Rule>
<Filter>[highway] = 'byway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="roads-text">
<Rule>
<Filter>[highway] = 'footway' or [highway] = 'bridleway' or [highway] = 'byway' or [highway] = 'residential' or [highway] = 'unclassified' or [highway] = 'tertiary'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="8" fill="#000" halo_radius="1" placement="line"/>
</Rule>
</Style>
<Layer name="leisure" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="waterway" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>river</StyleName>
<StyleName>stream</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="lakes" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>lakes</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>roads-casing</StyleName>
<StyleName>footway</StyleName>
<StyleName>cycleway</StyleName>
<StyleName>bridleway</StyleName>
<StyleName>byway</StyleName>
<StyleName>railway</StyleName>
<StyleName>residential</StyleName>
<StyleName>unclassified</StyleName>
<StyleName>tertiary</StyleName>
<StyleName>secondary</StyleName>
<StyleName>primary</StyleName>
<StyleName>trunk</StyleName>
<StyleName>motorway</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="amenity" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>amenity</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="roadstext" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>roads-text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
<Layer name="text" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
<Parameter name="file">test2.osm</Parameter>
</Datasource>
</Layer>
</Map>

531
plugins/input/osm/test3.xml Normal file
View file

@ -0,0 +1,531 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map>
<Map bgcolor="#d0d0d0" srs="+proj=latlong +datum=WGS84">
<Style name="amenity">
<Rule>
<Filter>[amenity]='pub'</Filter>
<PointSymbolizer file="/home/nick/images/pub.png" type="png"
width="16" height="16" />
</Rule>
<Rule>
<Filter>[man_made]='mast'</Filter>
<PointSymbolizer file="/home/nick/images/mast.png" type="png"
width="16" height="16" />
</Rule>
<Rule>
<Filter>[amenity]='parking'</Filter>
<PointSymbolizer file="/home/nick/images/carpark.png" type="png"
width="16" height="16"/>
</Rule>
<Rule>
<Filter>[residence]='farm'</Filter>
<PointSymbolizer file="/home/nick/images/farm.png" type="png"
width="16" height="16"/>
</Rule>
</Style>
<Style name="leisure">
<Rule>
<Filter>[landuse] = 'reservoir'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#89bac6</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[landuse] = 'cemetery'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">grey</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[landuse] = 'wood' or [landuse] = 'forest'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#aed1a0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[leisure] = 'park' or [leisure] = 'common' or
[leisure] = 'golf_course'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#d8e8d0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[natural] = 'wood'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#aed1a0</CssParameter>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter>[natural] = 'heath'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#ffe0c0</CssParameter>
</PolygonSymbolizer>
</Rule>
</Style>
<Style name='lakes'>
<Rule>
<Filter>[natural] = 'water'</Filter>
<PolygonSymbolizer>
<CssParameter name="fill">#89bac6</CssParameter>
</PolygonSymbolizer>
</Rule>
</Style>
<Style name="text">
<Rule>
<Filter>[place] = 'city'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="16" fill="#000" halo_radius="2" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[place] = 'town'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="14" fill="#000" halo_radius="2" wrap_width="20"/>
</Rule>
<Rule>
<Filter>[place] = 'village' or [place] = 'suburb'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="13" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[place] = 'hamlet'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="12" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[natural] = 'peak'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="11" fill="#000" halo_radius="1" wrap_width="0"/>
</Rule>
<Rule>
<Filter>[natural] = 'wood' or [natural] = 'water' or [natural] = 'heath'
or [leisure] = 'golf_course' </Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book"
size="10" fill="#000" halo_radius="2" wrap_width="0" />
</Rule>
</Style>
<Style name="river">
<Rule>
<Filter>[waterway] = 'river'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#89bac6</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="9" fill="white" placement="line"/>
</Rule>
</Style>
<Style name="stream">
<Rule>
<Filter>[waterway] = 'stream'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#89bac6</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="9" fill="white" placement="line"/>
</Rule>
</Style>
<Style name="roads-casing">
<Rule>
<Filter>[highway] = 'motorway' or [highway]='motorway_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#506077</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'trunk' or [highway] = 'trunk_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#477147</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'primary' or [highway] = 'primary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#8d4346</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'secondary' or [highway] = 'secondary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#a37b48</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'tertiary' or [highway] = 'tertiary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'minor' or [highway] = 'unclassified'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'residential' or [highway] = 'service'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'unsurfaced' or [highway] = 'track'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#999</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="motorway">
<Rule>
<Filter>[highway] = 'motorway' or [highway] = 'motorway_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#809bc0</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="trunk">
<Rule>
<Filter>[highway] = 'trunk' or [highway] = 'trunk_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#7fc97f</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="primary">
<Rule>
<Filter>[highway] = 'primary' or [highway] = 'primary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#e46d71</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="secondary">
<Rule>
<Filter>[highway] = 'secondary' or [highway] = 'secondary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fdbf6f</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="tertiary">
<Rule>
<Filter>[highway] = 'tertiary' or [highway] = 'tertiary_link'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#ffffc0</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="unclassified">
<Rule>
<Filter>[highway] = 'minor' or [highway] = 'unclassified'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="residential">
<Rule>
<Filter>[highway] = 'residential' or [highway] = 'service' or
[highway] = 'unsurfaced' or [highway] = 'track'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="bridleway">
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = ''</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">magenta</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [foot] = 'yes' and [horse] = 'yes'
and [bicycle] = 'yes'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'narrow'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#00c000</CssParameter>
<CssParameter name="stroke-width">1.0</CssParameter>
<CssParameter name="stroke-dasharray">1,5</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'path'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">#00c000</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">2,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'gravel'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">brown</CssParameter>
<CssParameter name="stroke-dasharray">6,4</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'bridleway' and [newforest_pathtype] = 'track'
</Filter>
<LineSymbolizer>
<CssParameter name="stroke">brown</CssParameter>
<CssParameter name="stroke-dasharray">2,4</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="footway">
<Rule>
<Filter>[highway] = 'footway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">magenta</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">1,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
<Rule>
<Filter>[highway] = 'footway' and [foot] = 'yes'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">1,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="cycleway">
<Rule>
<Filter>[highway] = 'cycleway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">blue</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-dasharray">4,4</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="byway">
<Rule>
<Filter>[highway] = 'byway'</Filter>
<LineSymbolizer>
<CssParameter name="stroke">#fff</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
<CssParameter name="stroke-opacity">0.4</CssParameter>
</LineSymbolizer>
<LineSymbolizer>
<CssParameter name="stroke">red</CssParameter>
<CssParameter name="stroke-width">2.0</CssParameter>
<CssParameter name="stroke-linejoin">round</CssParameter>
<CssParameter name="stroke-linecap">round</CssParameter>
</LineSymbolizer>
</Rule>
</Style>
<Style name="roads-text">
<Rule>
<Filter>[highway] = 'footway' or [highway] = 'bridleway' or [highway] = 'byway' or [highway] = 'residential' or [highway] = 'unclassified' or [highway] = 'tertiary'</Filter>
<TextSymbolizer name="name" face_name="DejaVu Sans Book" size="8" fill="#000" halo_radius="1" placement="line"/>
</Rule>
</Style>
<Layer name="leisure" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>leisure</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="waterway" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>river</StyleName>
<StyleName>stream</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="lakes" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>lakes</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="roads" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>roads-casing</StyleName>
<StyleName>footway</StyleName>
<StyleName>cycleway</StyleName>
<StyleName>bridleway</StyleName>
<StyleName>byway</StyleName>
<StyleName>railway</StyleName>
<StyleName>residential</StyleName>
<StyleName>unclassified</StyleName>
<StyleName>tertiary</StyleName>
<StyleName>secondary</StyleName>
<StyleName>primary</StyleName>
<StyleName>trunk</StyleName>
<StyleName>motorway</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="amenity" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>amenity</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="roadstext" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>roads-text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
<Layer name="text" status="on" srs="+proj=latlong +datum=WGS84">
<StyleName>text</StyleName>
<Datasource>
<Parameter name="type">osm</Parameter>
</Datasource>
</Layer>
</Map>