[postgis-devel] Reprojection issues

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Thu Jul 3 02:11:20 PDT 2008


Nico Mandery wrote:
> Hello list,
> 
> I got a problem reprojecting geometries from EPSG:3785 (the Google or 
> Web Mercator projection) to WGS84 (EPSG:4236).
> For example when I try to transform one point postgis gives me the 
> following - correct - result:
> 
> projects=# select 
> astext(st_transform(GeomFromText('POINT(879650.162980923 
> 6108535.16589579)',3785),4326));
>                  astext
> ------------------------------------------
> POINT(7.90203186083991 48.0100993171653)
> (1 row)
> 
> When I try it again with exactly the same query, I get a wrong result 
> and an error from libproj:
> 
> projects=# select 
> astext(st_transform(GeomFromText('POINT(879650.162980923 
> 6108535.16589579)',3785),4326));
> WARNING:  transform: -38 (failed to load NAD27-83 correction file)
>                      astext
> --------------------------------------------------
> POINT(1.23892476139034e-06 7.52729195068025e-06)
> (1 row)
> 
> Every following query will also return wrong results, until I close the 
> connection to the database. The first query after establishing a
> new connection to postgresql returns a correct result again, every 
> following raises the error again.
> The NAD correction files exist. Transforming coordinates with cs2cs from 
> libproj works without any problems.
> 
> I tried it with Postgresql 8.2.4 and 8.3.3 and postgis 1.3.2 and 1.3.3. 
> The proj4text in spatial_ref_sys for EPSG:3785 is
> "+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 +wktext +no_defs"
> 
> Thanks a lot,
> Nico


Hi Nico,

I'm not sure about the +wktext part of your proj4text as I've never seen 
that before - so maybe it is an invalid PROJ.4 string? What happens if 
you try the transformation using the standard proj executable?


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list