Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a leaflet map from which I want to be able to query an api that accepts x y values in EPSG 2232 as inputs. Leaflet doesn't handle point transformations like Open Layers does so I am trying to use proj4js. I created an epsg2232.js file for the 2232 transform and am using the existing epsg900913.js file that shipped with proj4 (see code below for actual epsg strings). The general work flow is:

  1. click event returns lat/long in Leaflet default EPSG 3857 (same as 900913)
  2. convert lat/long to EPSG 2232 x/y (see code below).

The code below currently does perform a transform but the numbers are off. For example: lat = 39.74043 long = -465.01719 transforms to X = 40674737.46566756 Y = 10890477.404555319. I expect the transformed x/y to be more like this x=3135764.7952012 y=1694936.04430735. I am unsure what the issue is as this seems like a simple task. It is very possible that I am missing something obvious. Does anyone have any idea what is causing the transform to behave this way?

// formatting lat long click event results to pass to proj4
// not the best method but bare with me
var lat_lng = e.latlng;
var lat_lng = lat_lng.toString();
var lat_lng = lat_lng.substr(7,20);
var lat_lng = new String(lat_lng);

var epsg900913 = new Proj4js.Proj('EPSG:900913');
var epsg2232 = new Proj4js.Proj('EPSG:2232');

var xy = new Proj4js.Point(lat_lng);
Proj4js.transform(epsg900913,epsg2232,xy);


// here is the EPSG string that epsg900913 references. 
//Proj4js.defs["EPSG:900913"]= "+title=GoogleMercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";

// here is the EPSG string that epsg2232 references. 
// Proj4js.defs["EPSG:2232"] = "+proj=lcc +lat_1=39.75 +lat_2=38.45 +lat_0=37.83333333333334 +lon_0=-105.5 +x_0=914401.8288036576 +y_0=304800.6096012192 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.