Hi I am making an app which uses a map downloaded from OpenStreetMap.

The map is of Edinburgh and I have used osm2pgsql to store the map in a PostGIS database.

Here is an example of the coordinates of points in the database when I execute the following query: select ST_AsGeoJSON(way) from planet_osm_point;


These coordinates are different than coordinates I have taken of map websites such as: http://itouchmap.com/latlong.html where coordinates in Edinburgh are like: 55.951324,-3.188095

Does anyone know why this is and how I convert my coordinates into the normal coordinates that are used on these mapping websites?


asked 30 Nov '12, 14:43

srose's gravatar image

accept rate: 0%

The coordinates you are seeing are in a different projection (called "Spherical Mercator"). Either re-run your osm2pgsql import with the -l (ell) flag to have standard WGS84 lat/lon values in the database, or modify your query to select ST_AsGeoJSON(ST_Transform(way,4326)) to re-project on the fly.

permanent link

answered 30 Nov '12, 15:10

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 30 Nov '12, 14:43

question was seen: 3,059 times

last updated: 30 Nov '12, 15:10

powered by OSQA