[OpenLayers-Users] Generated icons in a vector layer based on KML

Slawomir Messner slawomir.messner at staff.uni-marburg.de
Mon Apr 19 07:27:31 EDT 2010


Hi,
I want to add a vector layer with a generated KML file with generated 
icons. Both are generated together and then the KML-file is sent to the 
client. Then when the kml-file is loaded as a layer OL tries to get the 
icon files form a ASP handler, they are not generated by the handler 
they are already existing at the time when OL requests them. The 
icon-files are generated only once on a second call the already existing 
files are sent to the client.
So, now the problem: When I first call the layer no icons are visible on 
the second and the next tries the icons are visible.
1. I looked into firebug and all the icons are sent to the client.
2. Firebug tells me that the icons are there but the width and height 
are 0 when I change them the icon is visible.
3. I looked into the Format.KML and Renderer.SVG and they told me the 
width is 32x32 in the setStyle-function, I suppose it's the default 
value of OL my icons are smaller.
4. I saw in 3 you parse the w/h tags of icon in kml so I set them, but 
it doesn't help the w/h in firebug says it's both 0.
5. When I tried 3 and 4 I used some alerts and when I paste them into 
setStyle like this:
                 //if(this.test < 10)
                 //alert("1 : "+style.graphicWidth +" : 
"+style.graphicHeight);
                 var width = style.graphicWidth || style.graphicHeight;
                 var height = style.graphicHeight || style.graphicWidth;
                 //if(this.test < 10)
                 //alert("2 : "+width+" : "+height);
                 width = width ? width : style.pointRadius*2;
                 height = height ? height : style.pointRadius*2;
                 //if(this.test < 10)
                 //alert("3 : "+width+" : "+height);
                 this.test++;
a random number of icons appeared on the map.
6. I tried to delay the sending of the kml-file but no change.
7. I tried all if the icon-files are locked or something but it doesn't 
seem so and if you remember firebug says the files are ok.
8. I debugged the handler, but the files are ok and no hidden exception 
and the icons are not visible after a breakpoint, not like with the alert.
So that's all from me, anyone an idea?
Thanks
Slawomir

-- 
-----------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
06421-28-24981




More information about the Users mailing list