[OpenLayers-Users] Generated icons in a vector layer based on
KML
Slawomir Messner
slawomir.messner at staff.uni-marburg.de
Mon May 3 04:07:14 EDT 2010
Hi,
to complete this. I've solved the problem with this lines of code :
newLayer.events.register("loadend", newLayer,
function(evt){this.setVisibility(true);});
newLayer.visibility = false;
userContext.controller.map.addLayer(newLayer);
What happens:
If the layer is visible before loadend the symbols/graphics only show if
they are in the buffer, now when layer is invisible while waiting for
kml-data they come at the first time.
Slawomir Messner
Am 20.04.2010 11:19, schrieb Slawomir Messner:
> Hi again,
> it seems that Chome has the same problem, all images have 0/0
> dimensions. But in Chrome dims are also 0/0 when you call the layer
> again and the images are already generated at the first call.
>
> Am 19.04.2010 13:27, schrieb Slawomir Messner:
>
>> 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