[GIS] OSM To Postgis & WGS84 Newbie confusion

geoserveropenstreetmappostgis

I wonder if someone can clarify as I'm confused.

I need to load planet OSM data into PostGIS so I downloaded a small data set of a UK County and followed the instructions here loading the Google Mercator projection 900931.sql first.

looking at the data in GeoServer the co-ordinate readout on the location bar appears to be in metric East / West and not Longitude/Latitude yet the osm wiki states World Geodetic System 1984 is the coordinate system of OSM data.

What am I doing wrong?

Also is there a best practice for displaying OSM as a base layer?

Where can I get a Point.sld from?

Best Answer

OpenStreetMap stores data in WGS84 coordinates. You can check this by downloading the XML data for any OSM node:

 $ curl "http://www.openstreetmap.org/api/0.6/node/327031143"
 <?xml version="1.0" encoding="UTF-8"?>
 <osm version="0.6" generator="OpenStreetMap server">
   <node id="327031143" lat="44.4795174" lon="26.0865814" [..]>
[..]

However, the tool that imports the OSM data to postgresql (osm2pgsql) defaults to re-projecting node coordinates:

$ ./osm2pgsql --help

This will import the data from the OSM file(s) into a PostgreSQL database
suitable for use by the Mapnik renderer

Options:
[..]
   -l|--latlong     Store data in degrees of latitude & longitude.
   -m|--merc        Store data in proper spherical mercator (default)
   -M|--oldmerc     Store data in the legacy OSM mercator format
   -E|--proj num    Use projection EPSG:num
   -u|--utf8-sanitize   Repair bad UTF8 input data (present in planet

If you use the -l option, the postgresql database will contain WGS84 coordinates (EPSG 4326).