Skip to content
forked from emfcamp/buildmap

A GIS workflow pipeline for designing festivals

License

Notifications You must be signed in to change notification settings

sha2017/buildmap

 
 

Repository files navigation

Buildmap

A GIS workflow pipeline for designing festivals.

Buildmap takes a CAD site plan in DXF format and produces a slippy map for viewing on the web. It supports generating both raster layers (rendered with Mapnik), and untiled GeoJSON vector layers, which can be rendered by the map viewer.

Under the hood, Buildmap uses PostGIS, Magnacarto, Mapnik, and Tilestache. It allows you to visualise complex, multi-layered site plans in a simple way, with straightforward but powerful control over rendering.

Map of EMF 2016

A Diagram

buildmap diagram

Requirements

apt-get install postgresql-9.4 postgresql-9.4-postgis-2.1 gdal-bin tilecache ttf-mscorefonts-installer
apt-get install python-jinja2 python-mapnik python-psycopg2 python-gdal

You'll also need to install Magnacarto into your $PATH (you only need the magnacarto binary and not the webapp).

Source Files

You will need at least one .dxf file to use as a source, and at least one .mss (CartoCSS) file to control formatting. Each .mss file will produce one output layer (which can be controlled on the OpenLayers map).

Web Viewer

You will need a website with a javascript map viewer to view the generated tiles. Both OpenLayers 3 and Leaflet work for this, however OpenLayers seems to have better performance for vector layers.

The most up-to-date web interface currently is the SHA2017 maps site.

Setup

As the Postgres user:

createuser buildmap
createdb -O buildmap -EUNICODE [databasename]
psql -d [databasename] -c "CREATE EXTENSION postgis;"

Allow your user to access the GIS database. The easiest (although not necessarily most secure) way of doing this is to add the following line to pg_hba.conf

local   [databasename]         buildmap                   trust

Then test this with:

psql -U buildmap [database name]

Configuration

You need to create two configuration files - one (local.conf) will contain the host-specific configuration (paths and database details), the other (map.conf) will contain the rendering configuration for your map.

Example config files can be found in the config directory.

Running Buildmap

python ./buildmap.py /path/to/map.conf /path/to/local.conf

You can optionally pass the --preseed command line option, which will cause buildmap to generate all the tiles when it runs.

Alternatively you can use Tilestache to serve the map tiles dynamically, using the tilestache.json file generated by buildmap.

Notes on GDAL

GDAL (which provides the ogr2ogr tool used to import DXF files into PostGIS), has some version-specific issues, primarily with how it imports DXF hatches. Hatches are the only way to represent complex filled polygons with holes in (such as lakes with islands).

Some versions of GDAL produce lots of unintentional areas when rendering hatches. The following is a limited list of versions:

  • GDAL 1.10.1: Confirmed issues with hatching
  • GDAL 1.11.3: Known working
  • GDAL 1.11.5: Possible issues
  • GDAL 2.1.1: Possible issues
  • GDAL 2.1.2: Known working

Credits

Russ Garrett

This is based on Redlizard's work for OHM2013.

About

A GIS workflow pipeline for designing festivals

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.0%
  • CartoCSS 7.7%
  • HTML 1.4%
  • Other 0.9%