[OpenLayers-Users] Problems with "dynamic" image layers

Franz Buchinger fbuchinger at gmail.com
Mon May 16 03:36:48 EDT 2011


My OpenLayers Map consists of two image layers, one of the is an aerial
photo that should serve as a base layer, the other a semi-transparent
overlay image.

Both images are dynamically generated on the server based on extent
information supplied by the client. As a consequence, I don't know the urls
of these images in advance, therefore I have to wait with the layer creation
until the server responds my request with an image url plus extent
information.

This approach works fine with one image layer, but with the 2 dynamic images
i run into the following problems:

* The overlay image is generated much faster than the aerial photo. As
OpenLayers automatically assigns the first image layer as base layer, the
layer order is wrong (overlay not shown, because it is below rendered below
the aerial layer). However I don't want to wait with the layer generation
until both images have arrived because this would mean a rather poor
"perceived" performance. My goal is to show the overlay image as base layer
until the aerial image has arrived, but from that moment on it should be an
overlay layer. How can I implement this behaviour?

* Dragging or Zooming the image layers should trigger a re-rendering of both
images based on the changed extent of the map. I am not sure which event
listener strategy i should choose for this scenario. One option would be to
assign an "autonomous"  moveend/zoomend handler to each image layer that
just re-requests the contained image and then re-creates the layer with the
new image. The other option is a global map handler that requests both
images at once. As the server-side map creation is quite performance
intensive, i want to avoid duplicate requests caused by "bubbled up" events.
Which option is better in this regard?

thanks in advance,

Franz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110516/36f83125/attachment.html


More information about the Users mailing list