Me again,<br><br>I gave your hint a try, but it didn't work. Seems to be projection related. <br>As soon as there is an OSM Layer it seems one needs to project the Church picture.<br><br>Anyway, I gave up on that idea, and started moving the map to another div, and then display the Church picture instead, like this:<br>
<br>OpenLayers.Util.getElement('map2').innerHTML = OpenLayers.Util.getElement('map').innerHTML ;<br> <br>OpenLayers.Util.getElement('map').innerHTML = "<img src=\"pictures/"+globalresponse.responseText+"\"\/\>";<br>
<br>Problem is, the map doesn't work anymore afterwards?<br><br>Actually I am looking for this layout:<br>
One big picture of e.g. a Church, and a small map below (or in a corner of the picture).<br><br>Late render could probably re-render the map, but all browsing done to that moment would be lost.<br>Or can one really just display the overview map, without the map itself?<br>
<br>Ideas please?<br><br>Thanks,<br>Jan<br><br><div class="gmail_quote">On Wed, Jun 24, 2009 at 10:48 AM, Andreas Hocevar <span dir="ltr"><<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
the image layer was not made for displaying non-geographic images, but<br>
for maps. It seems you want to use OpenLayers to display images in the<br>
map pane, and for this we may have a better solution for you.<br>
<br>
Have a look at<br>
<br>
<a href="http://www.openlayers.org/dev/examples/georss-flickr.html" target="_blank">http://www.openlayers.org/dev/examples/georss-flickr.html</a><br>
<br>
This example shows you how to display images on point locations, and in<br>
popups (click on an image to see it).<br>
<br>
As for calculating the image size and the aspect ratio: that's exactly<br>
what we do for externalGraphic point symbols<br>
(<a href="http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Renderer/VML.js#L365" target="_blank">http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Renderer/VML.js#L365</a>).<br>
So if you want to do this, the solution is to register an<br>
onreadystatechange listener before setting img.src.<br>
<br>
Regards,<br>
<font color="#888888">Andreas.<br>
</font><div><div></div><div class="h5"><br>
Ilya Braude wrote:<br>
><br>
><br>
> Andreas Hocevar wrote:<br>
>>> Problem is how to calculate OpenLayers.Bounds?<br>
>>> Simply replacing<br>
>>> new OpenLayers.Bounds(-180, -88.759, 180, 88.759),<br>
>>> by<br>
>>> new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34)<br>
>>> did not work.<br>
>>> (It just blows up a single pixel to cover the whole map-div.)<br>
>>><br>
>><br>
>> The easiest for image layers that do not have to align with a map is<br>
>> to set the bounds according to the image size. So let's assume you<br>
>> have an image, like the one in the example, with is 580 pixels wide<br>
>> and 288 pixels high, then the best approach is to set the bounds to 0,<br>
>> 0, 580, 288.<br>
>><br>
> I have a similar use case where I do this in order to keep the proper<br>
> aspect ratio for the image. However, is there a way to have the bounds<br>
> be calculated automatically without me having to know the image size a<br>
> priori? For example, if the image URL is dynamic or user-submitted.<br>
><br>
> The only way I can think to do this (and I haven't tested this) is to<br>
> have the browser pre-load the image in a new <img/> tag, read the size<br>
> attributes from it, and then use those values for creating the image<br>
> layer. In this case, how do I know that the image has been downloaded<br>
> for me to read those attributes?<br>
><br>
> Something like:<br>
><br>
> var img = new Image();<br>
><br>
> img.src = "<a href="http://path.to/img/url" target="_blank">http://path.to/img/url</a>";<br>
><br>
> ...<br>
><br>
> var bounds = new OpenLayers.Bounds(0, 0, img.width, img.height);<br>
><br>
><br>
><br>
> Is there a way that OpenLayers can handle this if I don't care about<br>
> the extent of the image layer, just that it keeps it's aspect ratio<br>
> without me having to specify the correct (in terms of aspect ratio)<br>
> bounds?<br>
><br>
>><br>
>>> So how to calculate OpenLayers.Bounds to display the image at its<br>
>>> original<br>
>>> 100% size?<br>
>>><br>
>><br>
>> See above.<br>
>><br>
> I assume that by "above" you mean using the pixel size of the image<br>
> for the bounds? Would it make sense that this would be the default<br>
> behavior for an image layer and implemented by OL directly?<br>
> Thanks,<br>
> Ilya<br>
<br>
<br>
</div></div><div><div></div><div class="h5">--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
<br>
</div></div></blockquote></div><br>