From OpenStreetMap Wiki
Jump to: navigation, search

This page describes the varous scripts that can be found within the OSM repository, describing what they do, who maintains them and how they can be used. Detailed information about Perl Scripts can be found at Perl Scripts.

osm2pgsql - applications/utils/export/osm2pgsql

Maintainer: Jon Burgess

Synopsis: Converts from OSM XML to PostgreSQL (PostGIS) SQL. More efficient than Slippy_Map#python_script.


See also Mapnik#Loading_Data

 # ./osm2pgsql osm-data.osm > pgsql-out.sql

Handling compressed data (useful for planet.osm dumps)

 # gzip -dc planet-061112-a.osm.gz | ./osm2pgsql - | gzip -c > planet-061112-a.sql.gz


See the slippy map page for more details about importing the into PostgreSQL.

This script is written in C and must be compiled before use. It relies on the libxml2 library to parse the XML. You may have to install the development headers for this library before the code will compile.

On Fedora Linux:

 # yum install libxml2-devel

On Unix like systems, the code can be compiled by using the command:

 # make

from within the directory contained the C source file. The compiled executable file is called:




Maintainer - Nick B

Synopsis: - Contains various tests for the OSM API

Details - OSMTESTAPI is the beginnings of a set of Ruby classes that test the OSM API, by simulating common use cases. The script was written to test API 0.4 and will be useful for people wanting to populate test their home implementations of OSM, or perhaps for people developing client apps.