summaryrefslogtreecommitdiff
path: root/misc/openlayers/examples/osm-marker-popup.js
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/osm-marker-popup.js
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/osm-marker-popup.js')
-rw-r--r--misc/openlayers/examples/osm-marker-popup.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/misc/openlayers/examples/osm-marker-popup.js b/misc/openlayers/examples/osm-marker-popup.js
new file mode 100644
index 0000000..e8f39b5
--- /dev/null
+++ b/misc/openlayers/examples/osm-marker-popup.js
@@ -0,0 +1,39 @@
+var map;
+function init() {
+
+ // The overlay layer for our marker, with a simple diamond as symbol
+ var overlay = new OpenLayers.Layer.Vector('Overlay', {
+ styleMap: new OpenLayers.StyleMap({
+ externalGraphic: '../img/marker.png',
+ graphicWidth: 20, graphicHeight: 24, graphicYOffset: -24,
+ title: '${tooltip}'
+ })
+ });
+
+ // The location of our marker and popup. We usually think in geographic
+ // coordinates ('EPSG:4326'), but the map is projected ('EPSG:3857').
+ var myLocation = new OpenLayers.Geometry.Point(10.2, 48.9)
+ .transform('EPSG:4326', 'EPSG:3857');
+
+ // We add the marker with a tooltip text to the overlay
+ overlay.addFeatures([
+ new OpenLayers.Feature.Vector(myLocation, {tooltip: 'OpenLayers'})
+ ]);
+
+ // A popup with some information about our location
+ var popup = new OpenLayers.Popup.FramedCloud("Popup",
+ myLocation.getBounds().getCenterLonLat(), null,
+ '<a target="_blank" href="http://openlayers.org/">We</a> ' +
+ 'could be here.<br>Or elsewhere.', null,
+ true // <-- true if we want a close (X) button, false otherwise
+ );
+
+ // Finally we create the map
+ map = new OpenLayers.Map({
+ div: "map", projection: "EPSG:3857",
+ layers: [new OpenLayers.Layer.OSM(), overlay],
+ center: myLocation.getBounds().getCenterLonLat(), zoom: 15
+ });
+ // and add the popup to it.
+ map.addPopup(popup);
+}