File: export.md

package info (click to toggle)
osm2pgsql 0.96.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,304 kB
  • sloc: cpp: 11,462; python: 543; sh: 98; makefile: 17
file content (12 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
# Exporting with osm2pgsql #

Osm2pgsql can be used in combination with [ogr2ogr](http://www.gdal.org/ogr2ogr.html) and a [PostgreSQL data source](http://www.gdal.org/drv_pg.html).

An example command to export to GeoJSON would be

    ogr2ogr -f "GeoJSON" roads.geojson -t_srs EPSG:4326 \
      PG:"dbname=gis" -s_srs EPSG:3857 \
      -sql "SELECT name,highway,oneway,toll,way FROM planet_osm_line WHERE highway IS NOT NULL"

Care should be taken if exporting to shapefiles, as characters may be present
which cannot be represented in ISO-8859-1, the standard encoding for shapefiles.