I'm trying to figure out how to make some translations from UTM/ED50 to WGS84.
The reason I need to do them is that my data source's coordinates are in EPSG:23030 format, and I need to represent them in a map, currently using leaflet, which needs every coordinates to be in WGS84.
I've been using Postgis' raw sql queries to transform coordinates, as follows:
SELECT ST_AsText(ST_Transform(ST_GeomFromText('POINT(581087 4796507)', 23030), 4326));
That query returns me the following:
"POINT(-2.0013194711113 43.3151520669395)"
As I'm developing a web project using html+js and so on, I needed some library to make translations. So I found proj4js, and I can make translations as follows:
proj4.defs([
[
'EPSG:4326',
'+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees'
],
[
'EPSG:23030',
'+title=ED50 (UTM) +proj=utm +zone=30 +ellps=intl +units=m +no_defs'
]
]);
var coord = proj4('EPSG:23030', 'EPSG:4326').forward([581087,4796507]);
holding coord the following coordinate:
43.315428738109816, -2.000074748128657
So the question is why am I getting different coordinates, knowing that I'm -seemingly- using the same coordinate systems to make the translation in PostGis and in Proj4js? Is there something wrong?
As far as I know, the right conversion corresponds to PostGis.