[OpenLayers-Users] Using OL with Google baseLayer
Jacolin Yves
yjacolin at free.fr
Thu Oct 16 07:42:53 EDT 2008
Le Thursday 16 October 2008 12:42:34 Christopher Schmidt, vous avez écrit :
> On Thu, Oct 16, 2008 at 12:16:54PM +0200, Jacolin Yves wrote:
> > 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]
>
> This is not the Spherical Mercator projection. See
> http://trac.openlayers.org/wiki/SphericalMercator : +nadgrids=@null is
> missing.
>
> > 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');
>
> This one is right.
>
> > 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.0
> >17453292519943295]],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]
>
> Don't use this one.
>
> > If I am using the 900913 projection, my datas are shift to the south from
> > the right location.
>
> No. If you're using 54004, your data is shifted too far north.
>
> > 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 :(
>
> Regards,
thanks Christopher !
So I forgot the 54005 projection code ;)
I added the sql script for postgis in the wiki page you gave me.
Y.
--
Yves Jacolin
---
http://softlibre.gloobe.org
More information about the Users
mailing list