2009/2/26 Ric S <[email protected]>:
> Hi Folks,
>
> this is a little bit offtopic, but I think someone here might know the
> solution.
> I'm trying to transform osm data from my postgis db to lat lon values.
>
>  SELECT name, place, asText(transform(way,4326)) from planet_osm_point
> WHERE name = 'Ingolstadt' AND place = 'city' ORDER BY name;
>
> The result is:
>
> 11.4333         48.9570163662354
>
> If I use the values for example with google maps the resulting point is
> off by about 20km.  The expected result would be rather around 11.41 48.76.
>
> Any clue what's wrong?

I know what is wrong, but not why in Your case. 20km offset at ~48
degree is from additional Spheroid -> Elipsoid reprojection (changing
reference elipsoid besides datum conversion).
I had similar problem when converting SRTM -> GeoTIFF and needed to
tell gdal, that srtm was latlon projection with spheroid not WGS84
elipsoid.
 It means that in some point, probably at import time, besides
latlon->merc conversion there is also WGS84
elipsoid(6378137,298.257223563) -> spheroid(+a=6378137 +b=6378137).
Second reason could be bad srids definition in postgis. I have data in
900913, and transform works fine, I use osm2pgsql application i.e.:

> select getsrid(way),place, name, AsText(way), AsText(transform(way,4326)) 
> from planet_osm_point where place is not NULL and name = 'Płock';
>  getsrid | place | name  |                  astext                  |         
>     astext
> ---------+-------+-------+------------------------------------------+---------------------------------
>   900913 | city  | Płock | POINT(2192192.46829378 6900082.03008444) | 
> POINT(19.6928 52.5494099990897)

and in spatial_ref_sys srid definitions I have:
>  select * from spatial_ref_sys where srid = '900913' or srid = '4326';
>   srid  |      auth_name       | auth_srid |                                  
>                                                                               
>                                                                               
>                                      srtext                                   
>                                                                               
>                                                                               
>                                     |                                         
>                proj4text
> --------+----------------------+-----------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------
>    4326 | EPSG                 |      4326 | GEOGCS["WGS 
> 84",DATUM["WGS_1984",SPHEROID["WGS 
> 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
>                                                                               
>                                                                               
>                        | +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
>  900913 | spatialreference.org |         6 | PROJCS["unnamed",GEOGCS["unnamed 
> ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"],PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],EXTENSION["PROJ4","+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 
> +nadgri...@null +wktext  +no_defs"]] | +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 
> +nadgri...@null +wktext  +no_defs
> (2 rows)

I based my 900913 definition on:
http://genuchten.blogspot.com/2008/04/srid-stuff-in-postgis.html

PS. I'm not GIS expert, only what I needed at given moment and I could
confuse some definitions or terms, for what I apologize in advance

-- 
Marcin Rudowski
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to