[OpenLayers-Users] Using OL with Google baseLayer

Jacolin Yves yjacolin at free.fr
Thu Oct 16 06:16:54 EDT 2008


Hi list,

I am switching my OL baselayers to the Google Maps's one. So I have to change 
my projection for all my data to "google mercator". All my datas were in 
lambert 2 etendue (french projection, epsg code: 27572).

I succed to change it for all my shapefile using ogr2ogr or gdal with the 
following process:
add this in the epsg file :
[code]
# Google Mercator
<54004> +proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 
+units=m +no_defs <>
[/code]

and use : 
[code]
ogr2ogr -s_srs "EPSG:27572" -t_srs "EPSG:54004" destination.shp originale.shp
[/code]

BUT some of my datas are stored in a postgis database. I find two "epsg code" 
to add in the spatial_reference table:
[sql]
INSERT into spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) 
values (900913 ,'EPSG',900913,'GEOGCS["WGS 84", DATUM["World Geodetic System 
1984", SPHEROID["WGS 84", 6378137.0, 298.257223563,AUTHORITY["EPSG","7030"]], 
AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
NIT["degree",0.017453292519943295], AXIS["Longitude", EAST], AXIS["Latitude", 
NORTH],AUTHORITY["EPSG","4326"]], 
PROJECTION["Mercator_1SP"],PARAMETER["semi_minor", 6378137.0], 
PARAMETER["latitude_of_origin",0.0], PARAMETER["central_meridian", 0.0], 
PARAMETER["scale_factor",1.0], PARAMETER["false_easting", 0.0], 
PARAMETER["false_northing", 0.0],UNIT["m", 1.0], AXIS["x", EAST], AXIS["y", 
NORTH],AUTHORITY["EPSG","900913"]] |','+proj=merc +a=6378137 +b=6378137 
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m 
+nadgrids=@null +no_defs');

INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) 
VALUES (54004, 'spatialreference.org', 
54004, 'PROJCS["World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Mercator_1SP"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Standard_Parallel_1",0],UNIT["Meter",1],AUTHORITY["EPSG","54004"]]', '+proj=merc 
+lon_0=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs ');
[/sql]

If I am using the 900913 projection, my datas are shift to the south from the 
right location.

I would like to know wich one is "the best" to use and why I have some 
difference! I am mixing all this in my mind :(

I set up OL to use EPSG:900913 projection.

Thanks for your help,

Y.
-- 
Yves Jacolin
---
http://softlibre.gloobe.org



More information about the Users mailing list