summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/sundials-spherical-mercator.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/examples/sundials-spherical-mercator.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-ea346a785dc1b3f7c156f6fc33da634e1f1a627b.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/examples/sundials-spherical-mercator.html')
-rw-r--r--misc/openlayers/examples/sundials-spherical-mercator.html111
1 files changed, 111 insertions, 0 deletions
diff --git a/misc/openlayers/examples/sundials-spherical-mercator.html b/misc/openlayers/examples/sundials-spherical-mercator.html
new file mode 100644
index 0000000..3ee6144
--- /dev/null
+++ b/misc/openlayers/examples/sundials-spherical-mercator.html
@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <title>OpenLayers: Sundials on a Spherical Mercator Map</title>
+ <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+
+ <style type="text/css">
+ html, body {
+ height: 100%;
+ }
+ #map {
+ width: 100%;
+ height: 80%;
+ border: 1px solid black;
+ }
+ .olPopup p { margin:0px; font-size: .9em;}
+ .olPopup h2 { font-size:1.2em; }
+ </style>
+ <script src="../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+ var lon = 5;
+ var lat = 40;
+ var zoom = 5;
+ var map, select;
+
+ function init(){
+ var options = {
+ projection: new OpenLayers.Projection("EPSG:900913"),
+ displayProjection: new OpenLayers.Projection("EPSG:4326")
+ };
+ map = new OpenLayers.Map('map', options);
+ var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");
+ var gmap = new OpenLayers.Layer.Google("Google", {sphericalMercator:true});
+ var sundials = new OpenLayers.Layer.Vector("KML", {
+ projection: map.displayProjection,
+ strategies: [new OpenLayers.Strategy.Fixed()],
+ protocol: new OpenLayers.Protocol.HTTP({
+ url: "kml/sundials.kml",
+ format: new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true
+ })
+ })
+ });
+
+ map.addLayers([mapnik, gmap, sundials]);
+
+ select = new OpenLayers.Control.SelectFeature(sundials);
+
+ sundials.events.on({
+ "featureselected": onFeatureSelect,
+ "featureunselected": onFeatureUnselect
+ });
+
+ map.addControl(select);
+ select.activate();
+
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+
+ map.zoomToExtent(
+ new OpenLayers.Bounds(
+ 68.774414, 11.381836, 123.662109, 34.628906
+ ).transform(map.displayProjection, map.projection)
+ );
+ }
+ function onPopupClose(evt) {
+ select.unselectAll();
+ }
+ function onFeatureSelect(event) {
+ var feature = event.feature;
+ var selectedFeature = feature;
+ var popup = new OpenLayers.Popup.FramedCloud("chicken",
+ feature.geometry.getBounds().getCenterLonLat(),
+ new OpenLayers.Size(100,100),
+ "<h2>"+feature.attributes.name + "</h2>" + feature.attributes.description,
+ null, true, onPopupClose
+ );
+ feature.popup = popup;
+ map.addPopup(popup);
+ }
+ function onFeatureUnselect(event) {
+ var feature = event.feature;
+ if(feature.popup) {
+ map.removePopup(feature.popup);
+ feature.popup.destroy();
+ delete feature.popup;
+ }
+ }
+ </script>
+ </head>
+ <body onload="init()">
+ <h1 id="title">OSM + Google Maps + KML Reprojection</h1>
+
+ <div id="tags">
+ osm, kml, spherical, mercator, reprojection, feature, popup, advanced
+ </div>
+
+ <p id="shortdesc">
+ Demonstrates loading and displaying a KML file on top of OpenStreetMap (OSM) and Google Maps data. Loads data from a KML file of sundials.
+ </p>
+
+ <div id="map" class="smallmap"></div>
+
+ <div id="docs"></div>
+ </body>
+</html>