Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect projection for omerc when compared with proj4 #146

Closed
chitombo opened this issue Apr 28, 2015 · 8 comments
Closed

Incorrect projection for omerc when compared with proj4 #146

chitombo opened this issue Apr 28, 2015 · 8 comments

Comments

@chitombo
Copy link

I am working with openlayers and mapserver to write an application to view data which is in BRSO (feet)
when I test proj4js in converting the coordinates of a point
using

var brso = "+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +gamma=53.13010236111111 +ellps=evrstSS +towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4 +to_meter=0.3047994715386762 +no_defs ";
var utm50 = "+proj=utm +zone=50 +ellps=evrstSS +towgs84=-679,669,-48,0,0,0,0 +units=m +no_defs";
proj4(utm50,brso,[246094.008,600585.554]);

it returns
[1831236.398118216, 1971547.2288479938]
when i test the same conversion in postgis which is using proj4 ver 4.8.0
using

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(246094.008 600585.554)',29850),29872)) As wgs_geom;

I get "POINT(1829553.95081095 1971204.84230901)"
which is the same that ArcMap 10 gives me

Nothing I try seems to get me that accuracy on proj4js and I am not sure if it is a bug or an error on my part
Thank you for your assistance in this issue
Boris

@calvinmetcalf
Copy link
Member

it converts through wgs84 so you should check both utm50 to wgs84 and brso
to wgs84 to see which side of it the error is in

On Tue, Apr 28, 2015 at 9:38 AM chitombo notifications@github.com wrote:

I am working with openlayers and mapserver to write an application to view
data which is in BRSO (feet)
when I test proj4js in converting the coordinates of a point
using

var brso = "+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +gamma=53.13010236111111 +ellps=evrstSS +towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4 +to_meter=0.3047994715386762 +no_defs ";var utm50 = "+proj=utm +zone=50 +ellps=evrstSS +towgs84=-679,669,-48,0,0,0,0 +units=m +no_defs";
proj4(utm50,brso,[246094.008,600585.554]);

it returns
[1831236.398118216, 1971547.2288479938]
when i test the same conversion in postgis which is using proj4 ver 4.8.0
using

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(246094.008 600585.554)',29850),29872)) As wgs_geom;

I get "POINT(1829553.95081095 1971204.84230901)"
which is the same that ArcMap 10 gives me

Nothing I try seems to get me that accuracy on proj4js and I am not sure
if it is a bug or an error on my part
Thank you for your assistance in this issue
Boris


Reply to this email directly or view it on GitHub
#146.

@chitombo
Copy link
Author

I just ran the tests using

proj4(utm50).inverse([246094.008,600585.554])

I got [114.71134072129962, 5.428697284614796]
when tested against postgis

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(246094.008 600585.554)',29850),4326)) As wgs_geom;

I got "POINT(114.711335190215 5.42870835551611)"

I then tested

proj4(brso).forward([114.71134072129962, 5.428697284614796])

I got [1831236.393247835, 1971547.231159526]

in PostGIS

SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(114.711335190215 5.42870835551611)',4326),29872)) As wgs_geom;

I got "POINT(1829553.94602893 1971204.84371196)"

So it would appear the error is in the conversion to brso from wgs84

Thank you very much for your time and help with this issue

@calvinmetcalf
Copy link
Member

off the top of my head I'm going to guess that it doesn't like +gamma=53.13010236111111

@chitombo
Copy link
Author

Good morning,
I just tried removing the +gamma=53.13010236111111 from the string def

var testbrso = "+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +ellps=evrstSS +towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4 +to_meter=0.3047994715386762 +no_defs ";
proj4(testbrso).forward([114.71134072129962, 5.428697284614796]);

It doesn't appear to change the result
I still get [1831236.393247835, 1971547.231159526];

After reading around on the internet it appears that this brso projection has caused many headaches but I have no choice, I need to get consistent coordinates with those I am returning from PostGIS.

Thanks once again

@calvinmetcalf
Copy link
Member

var brso = "+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +gamma=53.13010236111111 +ellps=evrstSS +towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4 +to_meter=0.3047994715386762 +no_defs ";

I don't know where you got this from because EPSG 29872 is

+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +gamma=53.13010236111111 +ellps=evrstSS +towgs84=-679,669,-48,0,0,0,0 +to_meter=0.3047994715386762 +no_defs 

so this is one source of error though no where near all of it, stil looking into it

@chitombo
Copy link
Author

chitombo commented May 6, 2015

Thank you so much for your time and effort looking into this,
I got the different
+towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4
from the PostGIS definition, and thought it might be source of the error since PostGIS was giving me correct coordinates reprojected.
I also confirmed it here http://epsg.io/29872-1852
proj4.defs("EPSG:29872","+proj=omerc +lat_0=4 +lonc=115 +alpha=53.31582047222222 +k=0.99984 +x_0=590476.8727431979 +y_0=442857.6545573985 +gamma=53.13010236111111 +ellps=evrstSS +towgs84=-533.4,669.2,-52.5,0,0,4.28,9.4 +to_meter=0.3047994715386762 +no_defs");
I'm not sure if the error might not lie in the Geocentric Translations

@calvinmetcalf
Copy link
Member

what is the difference between 29872-1852 and 29872 ?

@chitombo
Copy link
Author

chitombo commented May 6, 2015

The difference is in the accuracy,
the default 29872 uses 3 parameters for the transformation to get 19m accuracy
the other is mostly used for Malaysia and uses 7 parameters for the transformation to get a 5m accuracy
the transformation is from the Timbalai 1948 datum to the WGS 84 datum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants