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_'s gravatar image

matthias_
55226
accept rate: 0%

retagged 14 Nov '11, 17:46

skorasaurus's gravatar image

skorasaurus
1.4k152736

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.

  1. Download country extract from somewhere
  2. Download poly-file of a city from somewhere
  3. Extract subsection with osmconvert 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

(20 Nov '11, 15:47) matthias_

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

permanent link

answered 14 Nov '11, 17:51

skorasaurus's gravatar image

skorasaurus
1.4k152736
accept rate: 12%

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.

permanent link

answered 15 Nov '11, 18:16

Vclaw's gravatar image

Vclaw
9.2k893140
accept rate: 22%

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.

permanent link

answered 16 Nov '11, 07:36

FischersFritz's gravatar image

FischersFritz
19117
accept rate: 0%

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

permanent link

answered 17 Nov '11, 20:11

skorasaurus's gravatar image

skorasaurus
1.4k152736
accept rate: 12%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×408
×327

question asked: 13 Nov '11, 09:22

question was seen: 4,297 times

last updated: 22 Nov '11, 16:40

powered by OSQA