Search code examples
data-conversioncoordinate-transformationwgs84proj4jsproj

Why I can't get correct value when used proj4js's method transform() (wgs84 -> utm-k)


I want to get correct value transform in proj4js.
coordinate converted value wgs84 (EPSG:4326) -> utm-k (EPSG:5179)

I tried to get coordinate converted value but i couldn't get correct value.

But other convert values were correct.

Coordinate is 제주도청 in korea.

Correct value :

wgs84 (lat = 33.48900054, lon = 126.4982831) ->   utm-k (906941.5, 1500134.1)  

Incorrect value :

wgs84 (lat = 33.48900054, lon = 126.4982831) ->  utm-k (5252601.193315057, 7146101.943385382) 

Why can't get correct value when used proj4js to convert wgs84 -> utm-k.

My source :

Proj4js.defs["EPSG:5179"] = "+proj=tmerc +lat_0=38 +lon_0=127.5 +k=0.9996 +x_0=1000000 +y_0=2000000 +ellps=GRS80 +units=m +no_defs";

Proj4js.defs["EPSG:5186"] = "+proj=tmerc +lat_0=38 +lon_0=127 +k=1 +x_0=200000 +y_0=600000 +ellps=GRS80 +units=m +no_defs";

var projWGS84 = new OpenLayers.Projection("EPSG:4326");

// projection for UTM-K   
var projUTMK = new OpenLayers.Projection("EPSG:5179");

var point_to_transform = new OpenLayers.LonLat(33.489219, 126.498379);

point_to_transform.transform(projWGS84, projUTMK);   
console.log(point_to_transform.lon, point_to_transform.lat);

or

//      var center4WMS = new OpenLayers.LonLat(33.489219, 126.498379);
//      var mapCenter = center4WMS.transform(projWGS84, projUTMK);
//      console.log( 'mapCenter : '+mapCenter.toShortString() );

But I can get correct value when I convert utm-k -> wgs84

anyway,result:

incorrect value image


Solution

  • sorry it was my mistake....

    I changed the latitude and longitude when i entered value in LonLat method.

    var point_to_transform = new OpenLayers.LonLat(126.498379, 33.489219);