[OpenLayers-Users] KML and area colorization

Andreas Hocevar ahocevar at opengeo.org
Wed Jun 17 10:31:53 EDT 2009


Hi,

On Wed, Jun 17, 2009 at 3:36 PM, VIDAUD
Romain<RVIDAUD at atmo-rhonealpes.org> wrote:
> When I make the sample page you gave deserialize my kml (copy paste content of kml file) everything is ok. When I use a "Layer.Vector" version, the zone is displayed and colorized but not on a good geographic location (under IE7) ..
>
> The script is :
>
> new OpenLayers.Layer.Vector("KML", {
>                        protocol: new OpenLayers.Protocol.HTTP({
>                            url: kmladress,
>                            format: new OpenLayers.Format.KML({
>                                extractStyles: true,
>                                extractAttributes: true
>                            })
>                        })
>                    });

You should configure a strategy with your layer:

new OpenLayers.Layer.Vector("KML", {
    protocol: new OpenLayers.Protocol.HTTP({
        url: kmladress,
        format: new OpenLayers.Format.KML({
            extractStyles: true,
            extractAttributes: true
        })
    }),
    strategies: [new OpenLayers.Strategy.Fixed()]
});

Intersting how your application works at all without it, but the
strategy will definitely take care of reprojecting your features to
the map's projection.

Regards,
Andreas.

>
> And I get as a result what can be viewed at
> http://www4.atmo-rhonealpes.org/site/OL_httpKML_layer.PNG (can give an real sample url cause it's on developpement server for now)
>
> Thanks,
>
> Romain
>
>
>
> -----Message d'origine-----
> De : andreas.hocevar at gmail.com [mailto:andreas.hocevar at gmail.com] De la part de Andreas Hocevar Envoyé : mardi 16 juin 2009 16:23 À : VIDAUD Romain Cc : users at openlayers.org Objet : Re: [OpenLayers-Users] KML and area colorization
>
> Hi,
>
> this issue is fixed in OpenLayers 2.8 (currently available as 2.8-rc6 under http://www.openlayers.org/api/2.8-rc6/OpenLayers.js).
>
> To verify, go to
> http://www.openlayers.org/dev/examples/vector-formats.html, select "KML" as format, paste the contents of your kml there, and hit "add feature".
>
> Regards,
> Andreas.
>
> On Mon, Jun 15, 2009 at 6:02 PM, VIDAUD
> Romain<RVIDAUD at atmo-rhonealpes.org> wrote:
>> Hello,
>>
>>
>>
>> I have a KML problem under IE7. I am drawing areas providing OL a KML
>> file generated by my webserver.
>>
>> Under Chrome and FF (and google earth when I download it) all is
>> correctly drawn and colorized, but with IE7, areas doesn't always have
>> their correct color (left white instead). Is there a known issue about it ?
>>
>> (use example can be viewed at
>> http://www4.atmo-rhonealpes.org/Site/Map/ChargerModule/161505/194/0/1)
>>
>> (KML file address is:
>> http://www4.atmo-rhonealpes.org/Site/Indice/KML/IndiceConfigPREVISIO/1
>> 5-06-2009/all)
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Romain VIDAUD
>>
>> Webmaster
>>
>>
>>
>> Atmo-RhôneAlpes
>>
>> Groupement d'Intérêt Economique d'Associations
>>
>> Agréées pour la Surveillance de la Qualité de l'Air
>>
>> AMPASEL - ASCOPARG - ATMO Drôme Ardèche - COPARLY - SUP'AIR
>>
>> Standard : 04 38 49 92 20 - contact at atmo-rhonealpes.org
>>
>> Info air: www.atmo-rhonealpes.org - 0810 800 710 (N° azur - Prix d'un
>> appel
>> local)
>>
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list