Regionalisedmap
From OpenStreetMap Wiki
Contents |
Localised Mapnik
To setup a localised mapnik like [cyOSM] follow the instructions on the Mapnik page making the following alterations:
In this example we want to render name:cy where it exists falling back to name where it doesn't. You will want to change name:cy for what ever variant you require.
Before Mapnik#Loading_Data
Add the relevant name:* tag (e.g. name:ca) to your default.style file. This file is part of osm2pgsql.
Before Mapnik#Rendering_with_Mapnik
Create localised views
Create localised views in the database: (these will need adjusting as the default.style changes)
CREATE VIEW planet_cyosm_line AS SELECT osm_id , access , admin_level , aerialway , aeroway , amenity , area , bicycle , bridge , boundary , building , cutting , disused , embankment , foot , highway , historic , horse , junction , landuse , layer , learning , leisure , man_made , military , motorcar , CASE WHEN "name:cy" IS NOT NULL THEN "name:cy" ELSE name END AS name, "natural" , oneway , POWER , power_source , place , railway , REF , religion , residence , route , sport , tourism , tracktype , tunnel , waterway , width , wood , z_order , way_area, lcn_ref , rcn_ref , ncn_ref , lcn , rcn , ncn , lwn_ref , rwn_ref , nwn_ref , lwn , rwn , nwn , route_pref_color , route_name , way FROM planet_osm_line; CREATE VIEW planet_cyosm_point AS SELECT osm_id , access , admin_level , aerialway , aeroway , amenity , area , bicycle , bridge , boundary , building , cutting , disused , embankment , foot , highway , historic , horse , junction , landuse , layer , learning , leisure , man_made , military , motorcar , CASE WHEN "name:cy" IS NOT NULL THEN "name:cy" ELSE name END AS name, "natural" , oneway , poi , POWER , power_source , place , railway , REF , religion , residence , route , sport , tourism , tunnel , waterway , width , wood , z_order , way FROM planet_osm_point; CREATE VIEW planet_cyosm_polygon AS SELECT osm_id , access , admin_level , aerialway , aeroway , amenity , area , bicycle , bridge , boundary , building , cutting , disused , embankment , foot , highway , historic , horse , junction , landuse , layer , learning , leisure , man_made , military , motorcar , CASE WHEN "name:cy" IS NOT NULL THEN "name:cy" ELSE name END AS name, "natural" , oneway , POWER , power_source , place , railway , REF , religion , residence , route , sport , tourism , tracktype , tunnel , waterway , width , wood , z_order , way_area , lcn_ref , rcn_ref , ncn_ref , lcn , rcn , ncn , lwn_ref , rwn_ref , nwn_ref , lwn , rwn , nwn , route_pref_color , route_name , way FROM planet_osm_polygon; CREATE VIEW planet_cyosm_roads AS SELECT osm_id , access , admin_level , aerialway , aeroway , amenity , area , bicycle , bridge , boundary , building , cutting , disused , embankment , foot , highway , historic , horse , junction , landuse , layer , learning , leisure , man_made , military , motorcar , CASE WHEN "name:cy" IS NOT NULL THEN "name:cy" ELSE name END AS name, "natural" , oneway , POWER , power_source , place , railway , REF , religion , residence , route , sport , tourism , tracktype , tunnel , waterway , width , wood , z_order , way_area , lcn_ref , rcn_ref , ncn_ref , lcn , rcn , ncn , lwn_ref , rwn_ref , nwn_ref , lwn , rwn , nwn , route_pref_color , route_name , way FROM planet_osm_roads; INSERT INTO geometry_columns VALUES ('', 'public', 'planet_cyosm_point', 'way', 2, 900913, 'POINT'); INSERT INTO geometry_columns VALUES ('', 'public', 'planet_cyosm_line', 'way', 2, 900913, 'LINESTRING'); INSERT INTO geometry_columns VALUES ('', 'public', 'planet_cyosm_polygon', 'way', 2, 900913, 'POLYGON'); INSERT INTO geometry_columns VALUES ('', 'public', 'planet_cyosm_roads', 'way', 2, 900913, 'LINESTRING');
Get Mapnik to use the views
Edit the set-mapnik-env script to use the localised views rather than the normal tables. Change the MAPNIK_PREFIX variable to (in this example) planet_cyosm