[OpenLayers-Dev] bad misaligning of KML point layers?

Andreas Hocevar andreas.hocevar at gmail.com
Tue Mar 11 06:48:02 EDT 2008


Roald de Wit wrote:
>> I created another patch that assumes that all Icon urls starting with
>> http://maps.google.com/mapfiles/kml have 64x64 icons.
>> Can anybody confirm/deny the validity of this assumption btw?
>>     
>
> I can confirm myself that the above is not true. The following url has a
> 32x32 icon:
> http://maps.google.com/mapfiles/kml/pal4/icon28.png
>
> But, since the scale halves the size of the icon that just got doubled
> in size, it effectively stays the same and the positioning still works,
> unless one uses a hotspot with a offset in pixels for that icon.
>
> What is a wise thing to do here?
>   

It is not hard to determine the size of an image:

var img = new Image();
img.src = "yourimageurl";
var width = img.width;
var height = img.height;

This could be either included in the KML styles parser (which would be 
the best place IMO), or in the renderer if no pointRadius, no 
graphicWidth and no graphicHeight are specified.

Regards,
Andreas.



More information about the Dev mailing list