Hacker News new | ask | show | jobs
by spapas82 2898 days ago
I am using more or less the instructions from switch2osm https://switch2osm.org/manually-building-a-tile-server-18-04... however for a Centos 7 server (we use Centos in my organization).

This results in having a tile server that generates & serves raster tiles using:

* carto to generate a proper stylesheet

* mapnik to create the tiles

* apache with the mod_tile module to serve the tiles

* renderd to be used as a bridge between apache/mod_tile and mapnik

* Postgres/PostGIS as a database to host the data

The actual data is an OpenStreetMap pbf file downloaded from http://download.geofabrik.de/ which is inserted to the database through osm2pgsql.

The above are used for the raster tile server only.

In addition to this, I am using geoserver (http://geoserver.org/) which is a Java web app (runs in tomcat) that is used to view/edit and (mainly) serve geospatial data. What I usually do is that when I need to display a new shape (shp) file I use shp2pgsql to insert it to a table in my PostGIS database (using something like this shp2pgsql -s SRID SHAPEFILE.shp SCHEMA.TABLE | psql -h HOST -d DATABASE -U USER) also another good tool is ogr2ogr which can convert between various formats (it also supports kml, for example ogr2ogr -f "PGDump" koko.sql test.kml).

After the shp file is inserted to the database, I can create a datasource for this dataset from GeoServer and publish this dataset to the web (i.e the dataset will have a URL of the form http://1.2.3.4:8080/geoserver/Dataset/wms); it can then be consumed by client applications (in javascipt) using leaflet or openlayers. Notice that GeoServer can easily publish various file formats for example an SHP directly (you don't need to insert it to the PostGIS; this is something I do for better control of my datasources).

PostGIS is the component that supports the vector tiles (http://docs.geoserver.org/latest/en/user/extensions/vectorti...) so I want to integrate it the OpenStreetMap data that is hosted in my PostGIS (which is used for the raster tiles); I haven't found the time yet though.

I think it's a great setup and it works great for the needs of the organization I work for; actually, I like it so much that I want (for a long time) to write a rather comprehensive tutorial on how to set ip up along with some notes on how to do various PostGIS things but I don't know when (and if) I'll find the time for something so large :/