[OpenLayers-Users] Turning on/off layers depending on zoom level

Erik Uzureau erik.uzureau at metacarta.com
Thu Apr 26 19:14:14 EDT 2007


See:
http://trac.openlayers.org/ticket/683

On 4/25/07, Erik Uzureau <erik.uzureau at metacarta.com> wrote:
>
> sending again without the build OL patch -- msg too big for list :-)
> erik
>
> ---------- Forwarded message ----------
> From: Erik Uzureau <erik.uzureau at metacarta.com>
> Date: Apr 25, 2007 8:15 PM
> Subject: Re: [OpenLayers-Users] Turning on/off layers depending on zoom
> level
> To: kaka <drspencer at hotmail.com>
> Cc: users at openlayers.org
>
> Hello,
>
> I have found some more time to look at this, and with your helpful
> description I think I am able to see the problem (and maybe solve it).
>
> The problem is that if the layer is out of range to start with, we never
> hide it. That's not good.
>
> I am including a patch that seems to fix this problem in your code.
>
> Can you tell me if this fixes it for you?
>
> If you don't know how to apply patches, I've also included a freshly build
> OL from trunk with this patch put in.
>
> Please let me know if this fixes your problem. I would like to open a
> ticket for this bug. It won't make it into the 2.4 release but in 2.5 for
> sure.
>
> Thanks for your bug report and your patience with explaining it :-)
> Erik
>
> On 4/22/07, kaka < drspencer at hotmail.com> wrote:
> >
> >
> > The problems I have with the maxResolution are:
> >
> > a) the markers are dislocated. Have a look at the link I posted and try
> > zooming out - the markers end up in the wrong positions.
> >
> > b) the markers are visible when thy should not appear. I would like them
> > to
> > appear when I zoom in the map, and not on first load. However, I keep
> > having
> > trouble with this. If they are set to show in the 0.03 resolution, the
> > example works just fine. If I set them to 0.02, or any other resolution
> > that
> > should make them not to render on first load, the example does no longer
> > work as expected. The markers are drawn anyway and in the wrong location
> > as
> > mentioned in a).
> >
> > Any help appreciated.
> >
> > Magnus
> >
> >
> >
> > Erik Uzureau-3 wrote:
> > >
> > > Kaka,
> > >
> > > It is hard for people to help you because we need a more detailed
> > > description of the problem.
> > > I personally do not understand what is going wrong here.
> > > Erik
> > >
> > > On 4/17/07, kaka <drspencer at hotmail.com> wrote:
> > >>
> > >>
> > >> Any help on this issue would be greatly appreciated. Could it be that
> >
> > >> this
> > >> is
> > >> a bug? The example is over at
> > >> http://www.villageografica.com/test44/Africa-test.html and my problem
> > is
> > >> that the maxResolution doesn´t work with the zoom ranges I want and,
> > >> also,
> > >> that the markers are not in the correct position.
> > >>
> > >> Magnus
> > >>
> > >>
> > >>
> > >>
> > >> kaka wrote:
> > >> >
> > >> > This is an example of the problem I have:
> > >> >
> > >> > http://www.villageografica.com/test44/Africa-test.html
> > >> >
> > >> > If I change the maxResolution to 0.2 the map works fine, but its
> > >> current
> > >> > 0.3 won´t work. I hope this illustrates my problem.
> > >> >
> > >> > Magnus
> > >> >
> > >> >
> > >> >
> > >> > Erik Uzureau-3 wrote:
> > >> >>
> > >> >> Dear Kaka,
> > >> >>
> > >> >> Do you have a live example that you could post a link to?
> > >> >> Offhand, I can't see what the problem is... but I might be
> > >> >> able to help you out if I could see it in action
> > >> >>
> > >> >> Erik,
> > >> >> Best
> > >> >>
> > >> >> On 4/10/07, kaka <drspencer at hotmail.com> wrote:
> > >> >>>
> > >> >>> Thank you very much, Erik, this has been a great help. However, I
> >
> > >> have
> > >> >>> run
> > >> >>> into a problem. If the markers are set to not show on first load,
> > but
> > >> to
> > >> >>> appear when zooming in, the show/hide functionality stops working
> > and
> > >> >>> the
> > >> >>> markers are dislocated when zooming out. My code looks like this:
> > >> >>>
> > >> >>> var MarkersLayer2 = new OpenLayers.Layer.Text( "Region info",
> > >> {location:
> > >> >>> "markers.txt", maxResolution: 0.03});
> > >> >>>
> > >> >>> Changing the "0.3" to "0.2" causes the problems mentioned above.
> > Is
> > >> this
> > >> >>> related to my code or a possible bug?
> > >> >>>
> > >> >>> Magnus
> > >> >>>
> > >> >>>
> > >> >>>
> > >> >>>
> > >> >>> kaka wrote:
> > >> >>> >
> > >> >>> > Hi
> > >> >>> > I am trying to turn on/off a layer of markers depending on zoom
> > >> level,
> > >> >>> > using google maps as a background layer. Does anyone have
> > >> suggestions
> > >> >>> on
> > >> >>> > how to achieve this or is there or maybe an example? Thank you
> > for
> > >> any
> > >> >>> > ideas.
> > >> >>> >
> > >> >>> > Regards,
> > >> >>> >
> > >> >>> > Magnus
> > >> >>> >
> > >> >>>
> > >> >>> --
> > >> >>> View this message in context:
> > >> >>>
> > >> http://www.nabble.com/Turning-on-off-layers-depending-on-zoom-level-tf3550126.html#a9927966
> >
> > >> >>> Sent from the OpenLayers Users mailing list archive at Nabble.com
> > .
> > >> >>>
> > >> >>> _______________________________________________
> > >> >>> Users mailing list
> > >> >>> Users at openlayers.org
> > >> >>> http://openlayers.org/mailman/listinfo/users
> > >> >>>
> > >> >> _______________________________________________
> > >> >> Users mailing list
> > >> >> Users at openlayers.org
> > >> >> http://openlayers.org/mailman/listinfo/users
> > >> >>
> > >> >>
> > >> >
> > >> >
> > >>
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/Turning-on-off-layers-depending-on-zoom-level-tf3550126.html#a10048769
> >
> > >> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> > >>
> > >> _______________________________________________
> > >> Users mailing list
> > >> Users at openlayers.org
> > >> http://openlayers.org/mailman/listinfo/users
> > >>
> > >
> > > _______________________________________________
> > > Users mailing list
> > > Users at openlayers.org
> > > http://openlayers.org/mailman/listinfo/users
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Turning-on-off-layers-depending-on-zoom-level-tf3550126.html#a10129213
> >
> > Sent from the OpenLayers Users mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070426/491761e7/attachment.html


More information about the Users mailing list