Code Monkey home page Code Monkey logo

toposm's Introduction

TopOSM

A system for rendering OpenStreetMap Based Topographic Maps

Requirements

TopOSM runs on Linux. It may be possible to build and run it on other platforms, but I have not tested this. If you try it, please let me know.

TopOSM depends on some fairly recent software, including:

  • Mapnik (2.0) with included patches and Cairo support
  • Python (2.6)
  • GDAL (1.7)
  • PostgreSQL + PostGIS
  • ImageMagick

(later versions than those mentioned above will probably work)

Installation

Required packages will vary depending on your distribution. For Ubuntu 11.04, this list of packages may be a good start:

python-mapnik mapnik-utils gdal-bin gdal-contrib python-gdal
libgdal-dev proj libproj-dev python-pyproj python-numpy imagemagick
gcc g++ optipng subversion postgresql postgresql-contrib
postgresql-server-dev-8.4 postgis wget libxml2-dev python-libxml2
libgeos-dev libbz2-dev make htop python-cairo python-cairo-dev
osm2pgsql unzip python-pypdf libboost-all-dev libicu-dev libpng-dev
libjpeg-dev libtiff-dev libz-dev libfreetype6-dev libxml2-dev
libproj-dev libcairo-dev libcairomm-1.0-dev python-cairo-dev
libpq-dev libgdal-dev libsqlite3-dev libcurl4-gnutls-dev
libsigc++-dev libsigc++-2.0-dev ttf-sil-gentium
ttf-mscorefonts-installer "ttf-adf-*"

Set up PostgreSQL with PostGIS, see: http://wiki.openstreetmap.org/wiki/Mapnik/PostGIS

Build local patched Mapnik

$ git clone https://github.com/mapnik/mapnik.git
$ cd mapnik
$ patch -p0 < <toposm-dir>/mapnik2_erase_patch.diff
$ python scons/scons.py configure \
    INPUT_PLUGINS=raster,osm,gdal,shape,postgis,ogr \
    PREFIX=$HOME PYTHON_PREFIX=$HOME
$ python scons/scons.py
$ python scons/scons.py install

If you need a more recent boost than available for your system, you can build one locally (i.e. with PREFIX=$HOME) and tell the mapnik configure step to link against that by adding:

BOOST_INCLUDES=$HOME/include BOOST_LIBS=$HOME/lib

Required data files

Configuring the Rendering Environment

Create the required directories for tiles and temp files:

$ mkdir -p temp tile

TopOSM is configured through environment variables. A template for this is included. Make a copy, modify it according to you system, and source it:

$ cp set-toposm-env.templ set-toposm-env
$ emacs set-toposm-env
$ . set-toposm-env

Import OSM data. The import will be cropped to the area specified in set-toposm-env.

$ ./import_planet geodata/osm/Planet.osm

The import script can also import OSM daily diffs (ending in .osc.gz).

Import NHD data:

$ ./import_nhd

Generate hillshade and colormaps:

$ ./prep_toposm_data

Add a shortcut for your area(s) of interest to areas.py.

Generate the mapnik style files from templates:

$ ./generate_xml

(you need to do this every time you modify the styles in the templates and include directories)

Create contour tables and generate contour lines, for example:

$ ./prep_contours_table
$ ./toposm.py prep WhiteMountains

To render tiles for the specified area and zoom levels:

$ ./toposm.py render WhiteMountains 5 15

To render a PDF, use renderToPdf() in toposm.py

Credits

Created by Lars Ahlzen ([email protected]), with contributions from Ian Dees (hosting, rendering and troubleshooting), Phil Gold (patches and style improvements), Kevin Kenny (improved NHD rendering, misc patches), Yves Cainaud (legend), Richard Weait (shield graphics) and others.

License: GPLv2

toposm's People

Contributors

ahlzen avatar asciipip avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

toposm's Issues

show trails on the map

This sure has super awesome maps :)

Can you modify it to show trails too?

I do a lot of mountain biking, and do some trail work. This is the best topo overlay with OSM that I've seen but I can't use it for trails.

I haven't looked at the code at all.

Patched mapnik still necessary? Missing xml files in templates/

Thanks for all your hard work! I'm having some luck getting this to run on the regular packages associated with Ubuntu 16.04. I intend to make a docker image out of this when I get done. One question, though: is it still necessary to build a patched version of mapnik, or did the patch find its way into Mapnik 3?

Now to the "bug": First, I'm using the fork by @asciiphil because it seems to have seen more recent activity than this repo; but there seems to be no "issues" tab in that repository. When I run ./toposm.py png <Area> <file> <x> <y> at the end of the process, quite a lot of the layers are missing xml files. Would it be possible to get templates for these committed to the @asciiphil repo?

root@55a88d6c6941:/home/bryce/TopOSM# ./toposm.py png Mineral test.png 5000 5000
 Rendering layers
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "./toposm.py", line 390, in run
    mapnik.load_map(map, self.mapname + ".xml")
RuntimeError: Could not load map file: File does not exist of 'features_top.xml'

This repeats for all of:

RuntimeError: Could not load map file: File does not exist of 'features_top.xml'
RuntimeError: Could not load map file: File does not exist of 'features_labels.xml'
RuntimeError: Could not load map file: File does not exist of 'contour-labels.xml'
RuntimeError: Could not load map file: File does not exist of 'features_mask.xml'
RuntimeError: Could not load map file: File does not exist of 'features_fills.xml'
RuntimeError: Could not load map file: File does not exist of 'contour-mask.xml'
RuntimeError: Could not load map file: File does not exist of 'features_outlines.xml'

I can remove these layers from MAPNIK_LAYERS for now, but at least one (contour-mask) is hardcoded somewhere else. Besides, it'd be nice to see what kind of map these missing files produce. :)

Thanks again!

Where is legend.py?

It has been a long time since any activity, but what happened to the legend script?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.