[OpenLayers-Users] please help us test OpenLayers 2.9RC1

Arnd Wippermann arnd.wippermann at web.de
Sat Apr 3 06:32:55 EDT 2010


Hi,

Because in previous versions of OpenLayers the map options parameters center
and zoom had not have an effect by the map construction, I have used them to
store values, which I use after adding the layers to the map. 

I think now, it's bad programming to store own values in the options for a
contructor.

And I like the possibility in 2.9 to build a whole map only with the map
construction.

Arnd

 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Tim Schaub
Gesendet: Samstag, 3. April 2010 07:02
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] please help us test OpenLayers 2.9RC1

bartvde at osgis.nl wrote:
> Hi Arnd,
> 
> thanks for your report. I've tracked that change down to:
> 
> http://trac.openlayers.org/changeset/10044
> 
> Tim, are you able to comment on Arnd's suggestion (see below)? TIA.
> 

http://trac.openlayers.org/ticket/2561

Calling setCenter before adding layers has always failed.  I considered it
equivalent behavior to require layers in the constructor if a center was
provided (and included a test to enforce this).

Arnd, while things might be working for you at 2.8, I'd consider it somewhat
risky to set map center (and zoom) in the options and then call setCenter
again with the same values after adding layers.  There are a number of
checks that compare the current center/zoom to the values passed to
setCenter.  If things haven't changed, I think it is reasonable to assume
that setCenter should do nothing.

Not sure what others think, but I can imagine that at some point we'd forget
this case and make it so setCenter had no effect if the passed values were
already set on the map.

Actually, it would probably be better to do whatever needs to be done in
setCenter without failing when there are no layers.

Anyway, the ticket is up for review.

Tim

> Best regards,
> Bart
> 
>> Hi Bart,
>>
>> I use the center parameter of the map options to store the center of 
>> my map.
>> After adding my layers to the map I use map.setCenter with this 
>> coordinate.
>>
>> With the OpenLayers 2.9 RC1 library, this raise an error "maxExtent 
>> is null", because if center is set in the options, this.setCenter is 
>> called at the end of the initialize-function. But then I have not 
>> added any layer to the map.
>>
>> It seems, that this will only work, if the layers parameter is also 
>> set in the map options.
>>
>> http://gis.ibbeck.de/OLClient/examples/testMapCenter_29_RC1.html
>>
>> I would suggest, that the setCenter in the init function should only 
>> be called, if this.options.layers != null.
>>
>>         // add any initial layers
>>         if (options && options.layers) {
>>             this.addLayers(options.layers);
>>         }
>>
>>         // set center (and optionally zoom)
>>         if (options && options.layers && options.center) {
>>             // zoom can be undefined here
>>             this.setCenter(options.center, options.zoom);
>>         }
>>
>>
>> And I have noticed, that with exchange of the OpenLayers.js from 2.8 
>> to 2.9, also the style.css have to be taken fom 2.9 with the css for 
>> the LayerSwitcher control.
>>
>> Otherwise it seems, that 2.9 works like 2.8. A great job from the 
>> OpenLayers developers.
>>
>> Arnd
>>
>>
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: users-bounces at openlayers.org 
>> [mailto:users-bounces at openlayers.org] Im Auftrag von Bart van den 
>> Eijnden
>> Gesendet: Mittwoch, 31. März 2010 18:01
>> An: openlayers; users user
>> Betreff: [OpenLayers-Users] please help us test OpenLayers 2.9RC1
>>
>> This is a reminder to everyone that OpenLayers 2.9 RC1 is out (since 
>> last Friday), please help us test this release candidate by upgrading 
>> your applications to 2.9RC1 and reporting any issues to us.
>>
>> See also:
>> http://trac.openlayers.org/wiki/Release/2.9/Announce/RC1
>>
>> Thanks in advance!
>>
>> Best regards,
>> Bart
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
> 
> 


--
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list