[OSM-talk] Installing your own tileserver on Ubuntu

Kai Krueger kakrueger at gmail.com
Tue Oct 18 16:06:56 BST 2011


Hi,

On 10/18/11 8:26 AM, Joseph Reeves wrote:
> hi Kai,
>
> Thanks a lot for this, it seems to be working well for me. I've got a
> question, although I accept that it might be a osm2pgsql query.
>
> I followed the instructions and imported Turkey into my db - this
> worked fine and I was happily rendering maps of the country. Since
> then I have used the same osm2pgsql command to import Bulgaria and
> Romania, but this seems to be causing issues:
>
> At the moment, only northern Romania is rendering as expected - for
> Turkey and Bulgaria I'm only seeing either pre-rendered tiles or new
> tiles based on nothing more than the coastline data. As far as I can
> tell, the only data currently in my db is for northern Romania.
>
> How best to check this? Is there a way to remove the pre-rendered
> tiles and create new ones from the contents of my db? Is there a
> different command I should be running to append data to an existing
> database?

The pre-rendered tiles are stored in /var/lib/mod_tile/default. You can 
simply delete those files and they will automatically get rerendered the 
next time you view them. You can also "touch" the planet import time 
stamp file (unfortunately I can't remember the exact location and name 
of the file atm). mod_tile checks the time stamp of the rendered tiles. 
If it is older than the time stamp of the planet import, it will assume 
the data has changed and attempt to rerender the tiles.

I have seen that you appear to need to restart renderd (sudo 
/etc/init.d/renderd restart) after a new import, as it otherwise appears 
to still use old data (It is kind of odd, so I might have the wrong 
impression here).

However, what you are trying to do is as far as I know not supported by 
osm2pgsql. Although it seems to be a much requested feature, I don't 
think osm2pgsql currently handles importing of multiple extracts. The 
--append option doesn't really do what you would think it does.

Osm2pgsql can currently either import a fresh extract, deleting the 
previous copy of your db, or it can "append" diff files. It can't append 
a second extract.

What you could potentially do is to change the extract file into a 
change file by changing the xml header and inserting a <modified> tag at 
the right place. However diff processing is currently one or two orders 
of magnitude slower than initial import mode, so doing that is likely to 
be prohibitively expensive.

Kai

>
> Thanks again, Joseph
>
>
>
>
> On 9 October 2011 23:13, Kai Krueger<kakrueger at gmail.com>  wrote:
>> Hello everyone,
>>
>> with the recent need to crack down on tile scrapers and apps to not over
>> tax the main OSM tileservers and hosting, there has been a lot of talk
>> trying to convince people to set up their own tileserver.
>>
>> Although that is of cause by far not the only hurdle to set up your own
>> tileserver, one barrier is perhaps the perceived complicated procedure
>> to set up all the elements necessary. Although there are a number of
>> decent howtos already available on the wiki (perhaps even to many, each
>> containing slightly different advice...), it is perhaps still more
>> effort than people want to get into.
>>
>> In the hope to make this process even simpler, I have created a bunch of
>> packages for Ubuntu containing all the necessary software, as well as
>> glue packages to deal with the necessary setup and interaction between
>> the different components.
>>
>> The packages aren't perfect yet, but hopefully sufficiently helpful
>> already to be of use to others who are interested in playing around with
>> their own tileserver.
>>
>> A simple standard tileserver can now be setup in 5 commands in a terminal:
>>
>> sudo add-apt-repository ppa:kakrueger/openstreetmap
>> sudo apt-get install libapache2-mod-tile
>> wget http://download.geofabrik.de/osm/north-america/us/colorado.osm.pbf
>> osm2pgsql -C 1500 colorado.osm.pbf
>> sudo /etc/init.d/renderd restart
>>
>> At the end you should have a working tileserver based on mod_tile and
>> renderd with the standerd OSM-mapnik stylesheet.
>>
>> You can test it out by opening the installed slippymap at
>> http://localhost/osm/slippymap.html
>>
>> You will of cause want to replace the above lines with the downloading
>> and importing of an extract with the extract you care about.
>>
>> Although for smaller areas hardware requirements aren't too bad, they
>> quickly go up beyond what can be handled by a standard desktop computer.
>> My rough guestimate of what a typical desktop / laptop can handle is
>> about an extract of 100 - 300 Mb (no more than an hours worth of
>> import). This covers most of the US and German states, as well as many
>> of the other less densely mapped countries.
>>
>> If you are more serious about your tileserver, you will need to tune the
>> various configuration settings, but just to play around and for personal
>> use, the default settings should work reasonable.
>>
>> More information can be found on yet another wiki-page... (
>> http://wiki.openstreetmap.org/wiki/Ubuntu_tile_server )
>>
>> Any comments or feedback are welcome,
>>
>> Kai
>>
>> _______________________________________________
>> talk mailing list
>> talk at openstreetmap.org
>> http://lists.openstreetmap.org/listinfo/talk
>>




More information about the talk mailing list