This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How can I exclude a specific area from rendering on my local map server?

1

Hi, I have set up a local map server. How can I remove a specific area from rendering? I want to black out some area.

asked 09 Jan '16, 11:34

Reshma%20Maner's gravatar image

Reshma Maner
235303136
accept rate: 0%

edited 09 Jan '16, 12:01

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554

2

What is your current setup? What is true shape you want to exclude from rendering?

(11 Jan '16, 04:59) yvecai

I have set up local OSM map tile server using osmtopgsql. I have imported India map data. For example, if I want to exclude Maharashtra data, then how can I do it?

I do not want it to be displayed on my map.

(12 Jan '16, 09:20) Reshma Maner

2 Answers:

0

One solution is to do this from your style file sql queries with postgis.

answered 10 Jan '16, 08:51

yvecai's gravatar image

yvecai
1.5k1226
accept rate: 9%

2

Can you please elaborate?

(11 Jan '16, 04:47) Reshma Maner

0

Assuming you are using the standing osm2pgsql/postgis/mod_tile approach, one simple solution is to just delete the data from your database. You can write a postgis query to delete everything a specified polygon, in essense, just cut it out.

If you are doing data updates (with osmosis) this might cause problems. If you want to keep the data up to date, another approach could be to save the area you don't want (Maharashtra) as a shapefile, and then configure the mapnik style to draw a white (or whatever other colour) polygon in that area. The resultant image will have that are "blocked out". Regular data updates should work in that case.

answered 12 Jan '16, 10:48

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

Thank you. I would like to go with second approach of using mapnik to draw a polygon in the area. How can I do it?

(12 Jan '16, 11:11) Reshma Maner

Source code available on GitHub .