[postgis-users] transform() does not do work for NGO1948 zone III-> WGS84 longlat (epsg:27393->epsg:4326)

Havard Tveite havard.tveite at umb.no
Fri Dec 23 06:19:05 PST 2005


An important omission in my earlier emails (sorry...):
The proj.4 epsg +lon_0 parameters (longitude offset) for the NGO
projections have been strange for the last couple of proj.4
releases. This has been reported as a bug in proj.4 bugzilla.
I have fixed the proj.4 epgs parameter file by hand to overcome
the problems.

I guess that the PostGIS spatial_ref_sys table is not
generated from the local proj.4 epsg file...
The longitude offset probably stems from this.

The epsg parameter file changes seems to have been made some
time after proj-4.4.7 (I think this version had correct values
for both latitude offset and towgs84).
Where the epsg "errors" come from, I don't know. It could be
an error introduced when generating the proj.4 epsg file, or
it could be an error in the EPSG sources. The fact that "NGO 1948"
and "NGO 1948 (Oslo)" use different prime meridians (Greenwich
and Oslo respectively) might be one of the sources of confusion.

I can still not explain the datum shift problems (or what
ever problem it might be).

Here are my local values for PostGIS 0.8 and 1.1:

select * from spatial_ref_sys where srid = 27393;

741, postgis 0.8:
 > 27393 | EPSG      |     27393 | PROJCS["NGO_1948_Oslo_Norway_Zone_3",GEOGCS["GCS_NGO_1948_Oslo",DATUM["D_NGO_1948",SPHEROID["Bessel_Modified",6377492.018,299.1528128]],PRIMEM["Oslo",10.72291666666667],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",0],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",0],PARAMETER["Scale_Factor",1],PARAMETER["Latitude_Of_Origin",58],UNIT["Meter",1]] | +proj=tmerc +lat_0=58 +lon_0=10.72291666666667 +k=1.000000 +x_0=0 +y_0=0 +a=6377492.018 +b=6356173.508712696 +pm=10.72291666666667 +units=m

82 cvs, postgis cvs:
 > 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

My share/proj/epsg (assuming that +lon_0 is supposed to give
the offset from +pm):
# NGO 1948 (Oslo) / NGO zone III
<27393> +proj=tmerc +lat_0=58 +lon_0=0 +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  <>

Michael Fuhr suggested to run cs2cs. With the correct lon_0
(0 for NGO 1984 zone 3), the results are:
echo 2836.394208896 185526.991186176 |
cs2cs +proj=tmerc +lat_0=58 +lon_0=0 \
       +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 \
       +to \
       +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs \
       -f "%.8f"
 > 10.76845023     59.66650218 0.30776738

Which still seems to be quite far (a few hundred meters) off.

Very strange that my UMN Mapserver (4.6.1) seems to perform a much
better transformation (within a couple of meteres)... (I have
checked visually how the NGO 1948 zone 3 dataset lines up with
datasets with other coordinate systems when transformed to WGS84
longlat).

Perhaps I will have to do some more homework before pursuing this
further...

Thank you for your efforts!


Haavard

Frank Warmerdam wrote:
> On 12/22/05, Havard Tveite <havard.tveite at umb.no> wrote:
> 
>>It is nice to provide warnings, but for epsg:27393 -> epsg:4326
>>the following problems persist:
>>
>>1) Longitude of origin (+lon_0=-10.72291666666667) is ignored
>>    (as demonstrated by strk's query).
> 
> 
> Havard,
> 
> Are you sure that the the +lon_0 is being ignored?  It seems more
> likely that it is being undone by the +pm=oslo.  There are a variety of
> problems with prime meridian handling in the EPSG->proj.4 translation
> process.  I would suggest modifying the PROJ.4 definition to not
> include the +pm=oslo and see if that helps.
> 
> 
>>2) No datum shift seems to be performed.
>>
>>Since the transformation runs smoothly using UMN Mapserver (
>>with dynamically linked proj - so it should be 4.4.9), there
>>is probably a problem somewhere.
> 
> 
> You are likely right, I'm not sure what the story is.
> 
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 

-- 
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



More information about the postgis-users mailing list