OSM open street map

https://switch2osm.org/serving-tiles/manually-building-a-tile-server-ubuntu-22-04-lts/

did this.  works.   using apache, but there was no specific apache config, but this worked and tile were appearing:


sudo nano /etc/apache2/sites-available/000-default.conf

Then inside the <VirtualHost *:80> block, add this at the end (but before </VirtualHost>):


apache

Copy

Edit

<IfModule mod_tile.c>

    LoadTileConfigFile /etc/renderd.conf

    ModTileRenderdSocketName /var/run/renderd/renderd.sock

    ModTileRequestTimeout 0

    ModTileMissingRequestTimeout 300

</IfModule>





To add a new country need to drop previous.


sudo systemctl stop renderd

sudo systemctl stop apache2

And disconnect DB beaver.


Then download new pbf

cd /mnt/raid1/downloads

wget https://download.geofabrik.de/europe/andorra-latest.osm.pbf


Merge them:

osmosis --rb andorra-latest.osm.pbf --rb azerbaijan-latest.osm.pbf --rb great-britain-latest.osm.pbf  --merge --merge --wb combined.osm.pbf


Drop the old gis db

sudo -u postgres dropdb gis

Then (from link above)

After:

sudo -u postgres -i



Run:

createdb -E UTF8 -O _renderd gis

and following steps

While still working as the “postgres” user, set up PostGIS on the PostgreSQL database:

psql

\c gis


(it’ll answer “You are now connected to database ‘gis’ as user ‘postgres’”.)

CREATE EXTENSION postgis;

(it’ll answer CREATE EXTENSION)

CREATE EXTENSION hstore;

(it’ll answer CREATE EXTENSION)

ALTER TABLE geometry_columns OWNER TO _renderd;

(it’ll answer ALTER TABLE)

ALTER TABLE spatial_ref_sys OWNER TO _renderd;

(it’ll answer ALTER TABLE)

\q

(it’ll exit psql and go back to a normal Linux prompt)

exit

(to exit back to be the user that we were before we did “sudo -u postgres -i” above)




Then import 

sudo -u _renderd osm2pgsql -d gis --create --slim  -G --hstore --tag-transform-script ~/src/openstreetmap-carto/openstreetmap-carto.lua -C 2500 --number-processes 1 -S ~/src/openstreetmap-carto/openstreetmap-carto.style combined.osm.pbf

from the combined file location.

Then again from Link above

Creating indexes

cd ~/src/openstreetmap-carto/
sudo -u _renderd psql -d gis -f indexes.sql

and Database function

cd ~/src/openstreetmap-carto/
sudo -u _renderd psql -d gis -f functions.sql

Shapefile download

(data already exists)

cd ~/src/openstreetmap-carto/
mkdir data
sudo chown _renderd data
sudo -u _renderd scripts/get-external-data.py


Then restart 

sudo systemctl daemon-reload
sudo systemctl restart renderd
sudo systemctl restart apache2






slow, 404 on tiles





Comments

Popular posts from this blog

Django Journey

github start project

Solr worked example with National Trees, from "Ground up" :)