[OpenLayers-Users] proj4js question

Christopher Schmidt crschmidt at metacarta.com
Wed Jul 23 15:09:35 EDT 2008


On Wed, Jul 23, 2008 at 08:34:10PM +0200, Patrick Valsecchi wrote:
> Hi Bart,
> 
> On Wednesday 23 July 2008, you wrote:
> > I am using the transform function of OpenLayers, which in its turn calls
> > proj4js, should it change the transformed property for all the points in a
> > geometry in your opinion? That does not seem effective does it?
> 
> Like Christopher said, you shouldn't have any reason to transform your 
> coordinates twice.

Er, I did? I don't remember that. In fact, there are many reasons to
need this.

> On one hand, proj4j is sparing some memory (I'm the first one to encourage 
> that, especially with a garbage collector in the way) by replacing the values 
> in the passed object, but, on the other hand, it adds a field to this object 
> eating some more memory. If it's for avoid some bugs, then it's a good idea, 
> but it's done wrong. A lib should not ignore a API call because it thinks its 
> a bug. Then how can the programmer notice he has something wrong in his code?

It doesn't 'ignore' it, it logs a message for the developer to read.

> If we broaden the discussion, the javascript world has IMHO way too much 
> places where the errors are silent and the input are assumed to be correct 
> (defined, of the good type and consistent) and never checked. 

THis is not the case here. The input is checked, the developer is
informed of the problem. This is not a proj4js library problem.

> I think the debug version of the libs (OpenLayers, Ext, proj4j, ...)
> should have extra code checking the consitency and reporting all
> errors (throwing exceptions).  For example, a constructor should check
> that all the mandatory settings are set, of the good type and
> consistent. That would help the developper to find errors as soon as
> possible. 

Patches welcome.

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list