Reputation: 11
I have a problem to convert between KKJ3 and WGS84 projections. The location differs about 10 kilometers from original WGS84 when I convert KKj3 to back WGS84 ? It seems that longitude is ok, but latitude is not.
In used: https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.12/proj4.js
Settings: 'EPSG:2393', '+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=3500000 +y_0=0 +ellps=intl +units=m +no_defs'
Code: Settings:
proj4.defs([
[
'EPSG:2393',
'+proj=tmerc +lat_0=0 +lon_0=27 +k=1 +x_0=3500000 +y_0=0 +ellps=intl +units=m +no_defs'
]
]);
var wgs = 'WGS84';
var kkj3 = 'EPSG:2393';
var str = "Changes:\n";
var KKJ3Value;
var WGS84Value;
User example:
KKJ3Value = proj4(wgs,kkj3,[UserLat,UserLon]);
str += "1.\tWGS84( " + UserLat + "," + UserLon + ")" + " => KKJ3\n";
str += "\tResult: " + KKJ3Value[0] + ","+ KKJ3Value[1] + "\n\n";
str += "2.\tKKJ3 => WGS84\n";
WGS84Value = proj4(kkj3,wgs,[KKJ3Value[0],KKJ3Value[1]]);
str += "\tResult: " + WGS84Value[0] + ","+ WGS84Value[1] + "\n";
alert(str);
Result: Result
Upvotes: 0
Views: 131
Reputation: 28727
You probably used the wrong order of longitude, latitude. Proj4 usually expects the order lon,lat, while you passed, lat,lon.
Remember longitude is related to x, and latitude to y.
The inverse projection is only accurate withing the region assigned to that projection (Finnland). see the red square at EPSG, which shows where the projection is applicable.
Since you passed a coordinate far outside of Finnland, the inverse projection does not work well anymore.
Upvotes: 0