### Transform OSM data to epsg: 4326 known as wgs84

The data is already in my Postgresql PostGIS set up using the osm2pgsql.exe to load it. You can of course specify other EPSG codes upon loading, but it seems to "not work" all the time so I prefer to go with the defaults then transform my data. Spatialreference.org is your best bet for more info.

This is the SQL I used to create a new column to store the OSM data in WGS84 or EPSG 4326. Be sure to change the bits you need for your data.

This is the SQL I used to create a new column to store the OSM data in WGS84 or EPSG 4326. Be sure to change the bits you need for your data.

```
--Transforming to Another spatial reference system
--first we create a new column to hold the new geometry in the new projection
SELECT AddGeometryColumn( 'planet_osm_line', 'geom_wgs84', 4326, 'LINESTRING', 2);
-- now we populate the new column with the transformed data using:
-- transform(geometrycol, new EPSG)
UPDATE planet_osm_line SET geom_wgs84 = transform(way, 4326);
--Transforming to Another spatial reference system
--first we create a new column to hold the new geometry in the new projection
SELECT AddGeometryColumn( 'planet_osm_point', 'geom_wgs84', 4326, 'POINT', 2);
-- now we populate the new column with the transformed data using:
-- transform(geometrycol, new EPSG)
UPDATE planet_osm_point SET geom_wgs84 = transform(way, 4326);
--Transforming to Another spatial reference system
--first we create a new column to hold the new geometry in the new projection
SELECT AddGeometryColumn( 'planet_osm_polygon', 'geom_wgs84', 4326, 'POLYGON', 2);
-- now we populate the new column with the transformed data using:
-- transform(geometrycol, new EPSG)
UPDATE planet_osm_POLYGON SET geom_wgs84 = transform(way, 4326);
```

## Comments

## Post a Comment