Importing Land Form PANORAMA

From OpenStreetMap Wiki
Jump to navigation Jump to search

This page describes a possible method to import and render Land-Form PANORAMA OpenStreetMap contour data. Land-Form PANORAMA (LFP) data is imported into a PostGIS database using a custom command-line application. The contents of the PostGIS database can then be rendered using Mapnik.

WARNING! Note that this is very much an experimental work-in-progress. Many of the applications are proof-of-concept "quick hacks" and will probably require you to edit the source for them to work on your system.

Method

  • Check out the custom command-line application necessary to perform this process using:

git clone https://github.com/nickw1/Freemap/tree/master/opendata

  • Obtain the desired LFP DXF files from the OS OpenData site or mirrors (e.g. MySociety).
  • Included in the repository is lfp - a simple command line application extract the contour DATA from a LFP DXF file into a PostGIS database. WARNING!!! This is a quick proof-of-concept hack. Error checking is not what it should be. Also note that it assumes that you have a table "contours" including a "way" field (geometry) for the contour itself, and a "height" field for its height. You need the Postgres C library installed (typically something like libpq-dev). Usage is simple:

./lfp DXFfile

  • Now that you have the contours in PostGIS you can render them with Mapnik. Ensure that there is an entry in the geometry_columns of your PostGIS database for the contours table. Add an entry with these values:

INSERT INTO geometry_columns(f_table_catalog,f_table_schema,f_table_name,f_geometry_column,coord_dimension,srid,type) VALUES (<blank string>,'public','contours','way',2,27700,'LINESTRING');

An example of a Mapnik XML file with the correct projection is here (also in the repository).

See also