Hi everyone,

I haven't found any useable source on the web which tells me how to convert data from OSM which I have imported with osm2pgsql into my postGIS database to another coordinate reference Systems (CRS) like UTM or lat/Long. How can I do this task with the integrated functions in the postGIS database or vice versa, how to convert data from another database with e.g. UTM coordinates to the format OSM is using?

Thanks, Stefan aka nordie69

asked 24 Jan '15, 20:47

nordie69's gravatar image

nordie69
45226
accept rate: 0%


Unless you have specified a different CRS upon import (using the -l or -E), your import is in EPSG:3857 a.k.a EPSG:900913. To convert to a different CRS, use the PostGIS ST_Transform method:

SELECT name, ST_AsText(ST_Transform(way, 4326))
FROM planet_osm_point
WHERE amenity='pub';
permanent link

answered 25 Jan '15, 00:40

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
60.6k74564949
accept rate: 23%

Use standard PostGIS function st_transform(geometry,EPSG#). Using ST_Setsrid is useful to ensure the DB knows which co-ordinate system it is using. It is relatively easy to alter the standard table to add additional geometry columns, but the tables may not then be suitable for updates.

osm2pgsql allows the specification of the desired co-ordinate system as a flag on input. I'd use this if working predominantly in one co-ordinate system.

permanent link

answered 25 Jan '15, 00:44

SK53's gravatar image

SK53 ♦
19.7k40207314
accept rate: 20%

edited 13 Mar '15, 16:08

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×144
×96
×92
×13

question asked: 24 Jan '15, 20:47

question was seen: 3,710 times

last updated: yesterday

powered by OSQA