# How do you pass parameters for Proj4js implementation with OpenLayers

I am using Proj4js along with OpenLayers for the transformation of x,y (projection type is Transverse Mercator) to long, lat.

While executing "`inverse()`" method what I noticed that in `tmerc.js` some "`this.ep2`" parameter is used with in the formula and the value of this parameter is "`NaN`".

Because of this the transformation is not working.

I am guessing that this is happening because perhaps I am not initializing required parameter with in the definition file of the source coordinate system.

So, could anyone help me in knowing which parameter for "`this.ep2`" has to be passed in definition file?

• i just realized that I didn't answer the question but maybe there's enough information to help you. May 25, 2012 at 15:46
• @mkennedy - That seems easily remedied! :) May 25, 2012 at 15:50

My guess without looking at the code is eccentricity prime squared. It can be calculated with:

a*a/b*b - 1

or

f*(2 - f) / (1 - f)*(1 - f)

a = semimajor axis b = semiminor axis f = flattening

It's interesting because usually e squared is used.

• thanks mKennedy :)...I got confused because I was expecting parameter "es" rather than "ep2"...that's because in the parameter list of "Proj4JS" they have mentioned parameter "es" for eccentricity prime squared...I guess there is a gap between standard parameter name & the variable name :) May 26, 2012 at 9:39

ep2 is calculated as follows in proj4js.js (the un-minified source) around line 964:

`````` this.ep2=(this.a2-this.b2)/this.b2; // used in geocentric
``````

where a2, b2 are a,b squared respectively; a is the semi-major radius and b the semi-minor radius.

ep2 should have been initialized at projection loading time, so perhaps you're missing something in your proj definition.