AW: [OpenLayers-Users] Vector Feature External Graphic Sizing

Arnd Wippermann arnd.wippermann at web.de
Mon Aug 1 16:17:48 EDT 2011


Hi,

with JS you could try this

function soso()
{
	alert(tata.height + ", " + tata.width);
}

var tata = new Image();
tata.src="http://urltoimage/some.png";
tata.onload = soso;
 
Arnd


-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von
MarcusRobbins
Gesendet: Montag, 1. August 2011 12:30
An: users at openlayers.org
Betreff: [OpenLayers-Users] Vector Feature External Graphic Sizing

Hi all! First time posting, thanks in advance for any response :)

I am creating Vector Features on a layer. I have defined a style map which
has a default style which supplies an external graphic.

I can succesfully define the pointRaduis or width/height for this external
graphic in the style.

However I would like to define the height/width to be the height/width of
the external graphic.

I do not currently know this size, so I would like OpenLayers to work it out
for me.

Is this currently possible?

It is difficult for me to find the size of the image in js, since finding
the size of the image requires rendering it in the browser. Waiting for that
render to happen requires an asynchronous call, which breaks the flow of
previously written code which is strictly synchronous.

I can work around this by working image size into the system from the ground
up, but it will cost me time. Is there any alternative?

Regards,
    Marcus

--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Vector-Feature-External-Graphic-Sizin
g-tp6640467p6640467.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list