[MetaCRS] Re: Adding Projection Classes to Proj4js

Mike Adair madair at dmsolutions.ca
Thu Jul 30 10:07:01 EDT 2009


Hi Richard,

Thanks for this,  I don't know about the math involved here but the 
coding looks fine.  It's best to have an independent test point to check 
this against and you could add that to proj4js/test/testdata.js.  I 
wouldn't want to add this without both the forward and inverse 
transforms however, can you do that one as well?

The best place to put this is as a patch on the Proj4js trac instance 
at: http://trac.osgeo.org/proj4js/,  create a new ticket and add a patch 
as an attachment.

Mike





Richard Marsden wrote:
> 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.
>
> I believe I have the forward transform working for an ellipsoid (see 
> below).
> 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.
>
> (I notice that many of the projections marked as untested, assume a 
> spherical Earth)
>
> Personally I don't need the inverse transform, but I'm also not sure 
> how to apply the ellipsoid correction to the inverse transform.
>
> I know the efficiency of the following code can be improved - eg. 
> cos(lat_ts) could be cached in the initialisation function.
>
>
> Richard
> -------------------------------
>
>
>   /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
>     ------------------------------------------------------------*/
>   forward: function(p) {
>     var lon=p.x;
>     var lat=p.y;
>     /* Forward equations
>       -----------------*/
>     dlon = Proj4js.common.adjust_lon(lon - this.long0);
>     var x,y;
>
>     if (this.sphere)
>     {
>        x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
>        y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
>     }
>     else
>     { // Radius at this latitude
>       var Sin_Lat = Math.sin(lat);
>       var Rn = this.a * (Math.sqrt(1.0e0 - this.es <http://this.es> * 
> Sin_Lat*Sin_Lat));
>
>       x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
>       y = this.y0 + Rn * Math.sin(lat) / Math.cos(this.lat_ts);
>     }
>
>     p.x=x;
>     p.y=y;
>     return p;
>   },//ceaFwd()
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> MetaCRS mailing list
> MetaCRS at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/metacrs
>   

-- 
   Michael Adair
   Senior Software Architect
   DM Solutions Group Inc.

   Office: (613) 565-5056 x26
   madair at dmsolutions.ca
   http://www.dmsolutions.ca
   http://research.dmsolutions.ca




More information about the MetaCRS mailing list