Further to last night's email, I now have an implementation of the cea "Cylindrical Equal Area" projection working. However it currently assumes a sphere.<br><br>I believe I have the forward transform working for an ellipsoid (see below).<br>
Does this look correct? I try to calculate the Earth's radius at the coord's latitude and use this for calculating the y ordinate. This is not applied to the x ordinate because this would break the "cylindrical" nature of the projection.<br>
<br>(I notice that many of the projections marked as untested, assume a spherical Earth)<br><br>Personally I don't need the inverse transform, but I'm also not sure how to apply the ellipsoid correction to the inverse transform.<br>
<br>I know the efficiency of the following code can be improved - eg. cos(lat_ts) could be cached in the initialisation function.<br><br><br>Richard<br>-------------------------------<br><br><br> /* Cylindrical Equal Area forward equations--mapping lat,long to x,y<br>
------------------------------------------------------------*/<br> forward: function(p) {<br> var lon=p.x;<br> var lat=p.y;<br> /* Forward equations<br> -----------------*/<br> dlon = Proj4js.common.adjust_lon(lon - this.long0);<br>
var x,y;<br><br> if (this.sphere)<br> {<br> x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);<br> y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);<br> }<br> else<br> { // Radius at this latitude<br>
var Sin_Lat = Math.sin(lat);<br> var Rn = this.a * (Math.sqrt(1.0e0 - <a href="http://this.es">this.es</a> * Sin_Lat*Sin_Lat));<br><br> x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);<br> y = this.y0 + Rn * Math.sin(lat) / Math.cos(this.lat_ts);<br>
}<br><br> p.x=x;<br> p.y=y;<br> return p;<br> },//ceaFwd()<br><br>