From 003312856ca0deb84215e79bfc0206f601da72af Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 5 Nov 2010 21:56:24 +0000 Subject: [PATCH] Update KML layer example. git-svn-id: http://svn.openlayers.org/trunk/openlayers@10875 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- examples/kml-layer.html | 64 +++++++++++++++++------------------------ examples/kml-layer.js | 22 ++++++++++++++ 2 files changed, 48 insertions(+), 38 deletions(-) create mode 100644 examples/kml-layer.js diff --git a/examples/kml-layer.html b/examples/kml-layer.html index b7217e6a20..90f1af9418 100644 --- a/examples/kml-layer.html +++ b/examples/kml-layer.html @@ -1,45 +1,33 @@ - - - - - - - - -

KML Layer Example

+ + + + + + + +

KML Layer Example

-
- KML -
+
KML
-

- Demonstrates loading and displaying a KML file on top of a basemap. +

+ Demonstrates loading and displaying a KML file on top of a basemap.

-
- +
+

+ A vector layer can be populated with features from a KML document + by configuring the layer with an HTTP protocol that points to the + KML document and is configured with a KML format for parsing features. + The fixed strategy is used to load all features at once. +

+

+ View the kml-layer.js + source to see how this is done. +

+
+ + + diff --git a/examples/kml-layer.js b/examples/kml-layer.js new file mode 100644 index 0000000000..1b0e85efd3 --- /dev/null +++ b/examples/kml-layer.js @@ -0,0 +1,22 @@ +var map = new OpenLayers.Map({ + div: "map", + layers: [ + new OpenLayers.Layer.WMS( + "WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", + {layers: "basic"} + ), + new OpenLayers.Layer.Vector("KML", { + strategies: [new OpenLayers.Strategy.Fixed()], + protocol: new OpenLayers.Protocol.HTTP({ + url: "kml/lines.kml", + format: new OpenLayers.Format.KML({ + extractStyles: true, + extractAttributes: true, + maxDepth: 2 + }) + }) + }) + ], + center: new OpenLayers.LonLat(-112.169, 36.099), + zoom: 11 +});