20 Dec 16:11
transform() does not do work for NGO1948 zone III -> WGS84 longlat (epsg:27393->epsg:4326)
Havard Tveite <havard.tveite <at> umb.no>
2005-12-20 15:11:52 GMT
2005-12-20 15:11:52 GMT
I have a table with coordinates in NGO1948, Zone 3 (epgs:27393). I would like to do transformations on the fly to WGS84 longlat (epsg:4326). "Reprojection" into WGS84 longlat (epsg:4326) works OK using Mapserver (fetching the data from postgres using the default epsg:27393 and projecting to epsg:4326 in Mapserver). No noticable errors in the output map, so I guess proj.4 is OK. When using transform() in postgis, however, the longitude of origin (+lon_0=-10.72291666666667) seems to be ignored, and there seems to be no datum shift performed (+towgs84=278.3,93,474.5,7.889,0.05,-6.61,6.21). Longitude of origin (+lat_0=58) seems to be used correctly. The following queries "demonstrate" the problem: select AsText(the_geom) from mndplngo; > POINT(2836.394208896 185526.991186176) select AsText(transform(the_geom,4326)) from mndplngo; > POINT(0.0464201635443672 59.6661916850467) (the longitude of origin is 10.72291666666667, so a longitude value of about 10.77 should be expected) select * from geometry_columns; > f_table_catalog | f_table_schema | f_table_name | f_geometry_column | coord_dimension | srid | type > -----------------+----------------+--------------+-------------------+-----------------+-------+------- > | public | mndplngo | the_geom | 2 | 27393 | POINT All the relevant information seems to be present in the spatial_ref_sys table: select * from spatial_ref_sys where srid=27393; > 27393 | EPSG | 27393 | PROJCS["NGO 1948 (Oslo) / NGO zone III",GEOGCS["NGO 1948 (Oslo)",DATUM["NGO_1948_Oslo",SPHEROID["Bessel Modified",6377492.018,299.1528128,AUTHORITY["EPSG","7005"]],TOWGS84[278.3,93,474.5,7.889,0.05,-6.61,6.21],AUTHORITY["EPSG","6817"]],PRIMEM["Oslo",10.72291666666667,AUTHORITY["EPSG","8913"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4817"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",58],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27393"]] | +proj=tmerc +lat_0=58 +lon_0=-10.72291666666667 +k=1.000000 +x_0=0 +y_0=0 +a=6377492.018 +b=6356173.508712696 +towgs84=278.3,93,474.5,7.889,0.05,-6.61,6.21 +pm=oslo +units=m +no_defs Is there a problem with transform(), or is it the spatial_ref_sys entry that is wrong, or am I doing something wrong here? I have postgresql CVS from some days ago and postgis CVS from today (solaris 2.7, gcc 3.3.2): select postgis_full_version(); POSTGIS="1.1.0" GEOS="2.1.4" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS -- -- Håvard Tveite Department of Mathematical Sciences and Technology, UMB Drøbakveien 14, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt
RSS Feed