[OpenLayers-Dev] Proj4js updates

Michael Adair madair at dmsolutions.ca
Mon Sep 10 10:24:44 PDT 2012


Sorry for crossposting but I suspect there are a lot of Proj4js devs on 
the OL list that aren't on the MetaCRS list and I'd like to get their 
feedback on this as well.

In any case, as part of getting Proj4js to compile using the Closure 
library in advanced mode, there is some cleanup that I would like to do 
at the same time.  I am proposing the following changes:

1. remove the dynamic loading of defs:  this implies that to use Proj4js 
you would need to have the 'defs' already loaded in your app before 
trying to create the Proj4js.Proj objects.   Most app frameworks like 
jQuery support AJAX calls that can be used to load defs dynamically  if 
required otherwise, I think apps typically know what coordinate systems 
will be used a priori so they can include the required defs statically.

2. if the library is no longer asynchronous, I suggest we can remove the 
callbacks passed to the constructor

3. the projection code gets included at compile time, so you can pick 
some or all of the projection code in a build config file. (eg. if you 
only need LCC, just include the LCC code in the build).  If you don't 
know which projection class you need, you can always build with the full 
code base.

I've got much of this working now (but not checked in yet) and there is 
some internal changes to the code structure but the external interface 
remains unchanged, ie. you still call Proj4js.transform() and the 
Proj4js.Proj constructors are the same except for removing the optional 
callbacks argument.

Comments welcome,

Mike




More information about the Dev mailing list