NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi,

I have a local tile server. I use osm2pgsql to import the osm map data to local server.

I want to clean up all the existing data and import fresh data. How can i do it?

asked 09 Feb '16, 11:21

Reshma%20Maner's gravatar image

Reshma Maner
235303136
accept rate: 0%

edited 09 Feb '16, 11:47

aseerel4c26's gravatar image

aseerel4c26 ♦
32.6k18248554


If you run osm2pgsql without --append it will automatically clear the database and import afresh. You might also want to manually clear your tile cache, likely in /var/lib/mod_tile to so.

permanent link

answered 09 Feb '16, 11:31

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

I executed following commands. But still map is not correctly displayed. Upper zoom level map is not displayed. On detailed zoom level only map shows.

sudo -u www-data osm2pgsql -C 2048 --slim --number-processes 4 india-latest.osm.pbf --cache-strategy sparse

touch /mod_tile/planet-import-complete

/etc/init.d/renderd restart

Path of my mod_tile directory is different than /var/lib. This path is mentioned in renderd.conf. Do I need to mention the path in osm2pgsql command also?

Also, after i execute above command, data of other countries which was renered previously should have been cleaned up. But it is not. It shows on map.

(09 Feb '16, 11:34) Reshma Maner
1

There are at least three places that "old data" can lurk. One is in the database; as Frederik has said osm2pgsql without --append will empty that and replace with whatever you're replacing it with.

The next is the metatile cache. If you look in "/var/lib/mod_tile" you'll see directories for each style you're displaying; if you haven't changed the name from "default" you'll see a directory called "default".

Below there you'll see subdirectories for each zoom level, perhaps something like this:

ls /var/lib/mod_tile/ajt
0  1  10  11  12  13  14  15  16  17  18  2  3  4  5  6  7  8  9

Below each subdirectory you'll eventually find ".meta" files such as:

ls /var/lib/mod_tile/ajt/0/0/0/0/0/0.meta
/var/lib/mod_tile/ajt/0/0/0/0/0/0.meta

To remove this cache, just delete these files.

Finally, there's the cache in your browser itself - usually a refresh will sort things out there.

(09 Feb '16, 13:35) SomeoneElse ♦

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:

×263
×2

question asked: 09 Feb '16, 11:21

question was seen: 8,560 times

last updated: 09 Feb '16, 13:36

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum