Hello OSM folks! I would like to render a map of a political region without the streets, etc. outside it. How am I doing this? Eg. selecting a state or province. Many thanks, Matthias asked 13 Nov '11, 09:22 matthias_ skorasaurus |
Well, Are you looking to map that you would like to have a copy of on your computer as a PNG or SVG or to later print out or a map that can be viewed online (called a slippy map) with multiple zoom levels, similar to google maps ? If you're looking for something to print out on paper or as an image on your computer, this question can help you answer your question. Note that in this situation, you'll have to download an extract of OSM data (extracts are offered by country, state/province, and metropolitan area. If you're looking to make a map to embed on your own website, there's been several other users who have done this and this question lays out the options of which renderer to use. There may be an existing service that already creates this type of map. If you have a specific question or are confused about something after reading that over, feel free to ask here, forum.osm.org, or on the OSM IRC channel. irc.oftc.net - #osm answered 14 Nov '11, 17:51 skorasaurus 1
Many thanks Skorasaurus. It's true, my initial question was pretty inprecise. I would like to have a tile server which serves global tiles, but only has features for the Canton of Zurich. I found a Zurich extract on cloudmade. However, it's pretty outdated (from August). It's why I downloaded the Switzerland extract from geofabrik. And I thought there is a possibility to render only the features within the political region through a query in Mapniks osm.xml. Is it possible to adapt the query to something related to this relation http://www.openstreetmap.org/browse/relation/27970? Many thanks again for your fast response! It's very much appreciated! Best, Matthias
(15 Nov '11, 10:56)
matthias_
Matthias, you should probably look for local support on the talk-ch mailing list. I noticed that you posted on the Swiss forum however that is essentially dormant. Simon
(19 Nov '11, 21:55)
SimonPoole ♦
|
You can use Osmosis or Osmconvert to extract the data from within a bounding polygon. The bounding polygon needs to be specified in Polygon Filter File Format. That page has links to tools from converting from .osm format to poly format. So you can download the Zurich boundary relation, then convert it to a polygon file. Then you could download the Switzerland extract, and use Osmosis or Osmconvert to extract just Zurich from that. Then load that extract into your database, and render it as usual with Mapnik. answered 15 Nov '11, 18:16 Vclaw |
You rather want to use the current boundary-relation of the Canton Zürich to cut your file: http://www.openstreetmap.org/browse/relation/1690941 The one you mentioned does not contain any borders. If the whole cutting procedure by means of Osmosis is too complicated you may just download the data via JOSM and cut it manually, although not being overly elegant. answered 16 Nov '11, 07:36 FischersFritz |
Mathias, I've also trying to create a political area as well although I have been unsuccessful so far. I outlined how to do it in a diary entry - http://www.openstreetmap.org/user/skorasaurus/diary/15250 although I wouldn't expect it to work for you because it didn't for me, but it may be worth a shot to try. As FischersFritz mentioned, you'll want to use the boundary-relation that consists of the boundaries of Zurich. http://www.openstreetmap.org/browse/relation/1690941 answered 17 Nov '11, 20:11 skorasaurus |
Many thanks for your answers!
osmosis and osmconvert are the only necessary tools!
It eventually worked out wonderfully: I've created an extract with a poly-file and then rerun Mapnik.
bzcat ../../planet/switzerland.osm.bz2 | ./osmconvert - -B=zurich.poly >../../planet/zurich-only.osm
You can also merge other stuff to it (in case there was subtracted too much stuff):
./osmosis --rx ~/planet/switzerland.coastline.osm.bz2 --rx ~/planet/zurich-only.osm.bz2 --merge --wx ~/planet/kanton-zh-with-lakes.osm