[OpenLayers-Users] OpenLayers.Layer.Image.setUrl Possible bug

Linda Rawson linda.rawson at gmail.com
Mon Sep 17 14:07:51 EDT 2007


Well I was trying to add an image layer just like city lights.  Basically a
transparent gif that I could "swap" out when the user got a little closer.
So I saw the seturl function and thought cool.  That would work.  I have
ended up implementing another work around.

1.  Add an image to the map

var layerResolutions = [0.703125,0.3515625,0.17578125,0.087890625,
0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,
0.00137329101,0.00068664550781,0.00034332275391,0.00017166137695,
0.00008635777450];
var imageOptions = {resolutions: layerResolutions,transparent: "true"};

graphic = new OpenLayers.Layer.Image(

'US',

hostUrl + "imgs/blank.gif",

map.getMaxExtent(),

new OpenLayers.Size(798, 598),

imageOptions);

 graphic.displayInLayerSwitcher = false;

graphic.setVisibility(true);

graphic.isBaseLayer = false;

map.addLayer(graphic);

2.

map.events.register('moveend', map, function (e) {

var myScale = (map.getMaxResolution() / map.getResolution());

 if (myScale >= 1024) {

 var graphicURL = hostUrl + "imgs/blue.gif";
graphic.setUrl(graphicURL);

}

}

I am on IIS with IE.

Thanks,
Linda Rawson

On 9/17/07, Schuyler Erle <schuyler at nocat.net> wrote:
>
> * On 17-Sep-2007 at 12:27AM PDT, Linda Rawson said:
> > There is a bug in 2.4 for setUrl.  I get an error.  So when I look at
> the
> > rest of the class it appears all I need to change is the line
> >
> > this.draw();
> >
> > to
> >
> > this.tile.draw();
> >
> > This locks up the application.  Has anybody else ran into this?
>
> Hi, Linda. It's quite possible there's a bug there. Could you please
> describe what you're trying to do that causes the error, and what the
> error is in more detail? Also, what platform and browser are you
> experiencing the lock up in? Without more information, it will be
> difficult to offer assistance.
>
> SDE
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070917/fcf46bd8/attachment.html


More information about the Users mailing list