playground:karten
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
playground:karten [2011/10/28 13:26] – admin | playground:karten [2015/05/12 12:10] (aktuell) – admin | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== Test Karten ====== | ||
+ | |||
+ | < | ||
+ | <div id=" | ||
+ | < | ||
+ | <a href=" | ||
+ | <div id=" | ||
+ | <script src=" | ||
+ | <script src=" | ||
+ | <script type=" | ||
+ | var lon = 10.45152; | ||
+ | var lat = 51.16569; | ||
+ | var zoom = 6; | ||
+ | var features, points; | ||
+ | |||
+ | // start tom.js | ||
+ | |||
+ | function jumpTo(lon, lat, zoom) { | ||
+ | var x = Lon2Merc(lon); | ||
+ | var y = Lat2Merc(lat); | ||
+ | map.setCenter(new OpenLayers.LonLat(x, | ||
+ | return false; | ||
+ | } | ||
+ | |||
+ | function Lon2Merc(lon) { | ||
+ | return 20037508.34 * lon / 180; | ||
+ | } | ||
+ | |||
+ | function Lat2Merc(lat) { | ||
+ | var PI = 3.14159265358979323846; | ||
+ | lat = Math.log(Math.tan( (90 + lat) * PI / 360)) / (PI / 180); | ||
+ | return 20037508.34 * lat / 180; | ||
+ | } | ||
+ | |||
+ | function addMarker(layer, | ||
+ | |||
+ | var ll = new OpenLayers.LonLat(Lon2Merc(lon), | ||
+ | var feature = new OpenLayers.Feature(layer, | ||
+ | feature.closeBox = true; | ||
+ | feature.popupClass = OpenLayers.Class(OpenLayers.Popup.FramedCloud, | ||
+ | feature.data.popupContentHTML = popupContentHTML; | ||
+ | feature.data.overflow = " | ||
+ | |||
+ | var marker = new OpenLayers.Marker(ll); | ||
+ | marker.feature = feature; | ||
+ | |||
+ | var markerClick = function(evt) { | ||
+ | if (this.popup == null) { | ||
+ | this.popup = this.createPopup(this.closeBox); | ||
+ | map.addPopup(this.popup); | ||
+ | this.popup.show(); | ||
+ | } else { | ||
+ | this.popup.toggle(); | ||
+ | } | ||
+ | OpenLayers.Event.stop(evt); | ||
+ | }; | ||
+ | marker.events.register(" | ||
+ | |||
+ | layer.addMarker(marker); | ||
+ | map.addPopup(feature.createPopup(feature.closeBox)); | ||
+ | } | ||
+ | |||
+ | function getCycleTileURL(bounds) { | ||
+ | var res = this.map.getResolution(); | ||
+ | var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w)); | ||
+ | var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h)); | ||
+ | var z = this.map.getZoom(); | ||
+ | var limit = Math.pow(2, z); | ||
+ | |||
+ | if (y < 0 || y >= limit) | ||
+ | { | ||
+ | | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | x = ((x % limit) + limit) % limit; | ||
+ | |||
+ | | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // end tom.js | ||
+ | |||
+ | function init() | ||
+ | { | ||
+ | // create a new map | ||
+ | var map = new OpenLayers.Map(' | ||
+ | projection: | ||
+ | displayProjection: | ||
+ | controls: [], | ||
+ | numZoomLevels: | ||
+ | maxExtent: new OpenLayers.Bounds(-20037508.34, | ||
+ | numZoomLevels: | ||
+ | maxResolution: | ||
+ | units: ' | ||
+ | }); | ||
+ | |||
+ | // add layers | ||
+ | var layer_mapnik = new OpenLayers.Layer.OSM.Mapnik(" | ||
+ | var layer_osm = new OpenLayers.Layer.OSM.Osmarender(" | ||
+ | map.addLayers([layer_osm]); | ||
+ | | ||
+ | // | ||
+ | //var layer_style = OpenLayers.Util.extend({}, | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | // | ||
+ | | ||
+ | // add control elements | ||
+ | map.addControl(new OpenLayers.Control.Navigation()); | ||
+ | map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon: | ||
+ | map.addControl(new OpenLayers.Control.ScaleLine()); | ||
+ | map.addControl(new OpenLayers.Control.KeyboardDefaults()); | ||
+ | |||
+ | //Feature points | ||
+ | features = new Array(); | ||
+ | var lonlat_id = new OpenLayers.LonLat(12.9279, | ||
+ | lonlat_id = lonlat_id.transform(new OpenLayers.Projection(" | ||
+ | var feature_id = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point( lonlat_id.lon, | ||
+ | features.push(feature_id); | ||
+ | | ||
+ | // Create a styleMap to style your features for two different render intents. The style for the ' | ||
+ | // applied when the feature is first drawn. The style for the ' | ||
+ | var myStyles = new OpenLayers.StyleMap({ | ||
+ | " | ||
+ | pointRadius: | ||
+ | fillColor: "# | ||
+ | strokeColor: | ||
+ | strokeWidth: | ||
+ | }), | ||
+ | " | ||
+ | fillColor: "# | ||
+ | strokeColor: | ||
+ | }) | ||
+ | }); | ||
+ | | ||
+ | // Create a vector layer and give it your style map. | ||
+ | points = new OpenLayers.Layer.Vector( ' | ||
+ | points.addFeatures( features ); | ||
+ | map.addLayer( points ); | ||
+ | | ||
+ | // Create a select feature control and add it to the map. | ||
+ | var select = new OpenLayers.Control.SelectFeature(points, | ||
+ | hover: true, onSelect: onFeatureSelect, | ||
+ | }); | ||
+ | map.addControl( select ); | ||
+ | select.activate(); | ||
+ | | ||
+ | // set center and zoom level | ||
+ | var lonlat = new OpenLayers.LonLat(lon, | ||
+ | map.setCenter( lonlat.transform( new OpenLayers.Projection(" | ||
+ | } | ||
+ | |||
+ | function onFeatureSelect(feature) | ||
+ | { | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | |||
+ | function onFeatureUnselect(feature) | ||
+ | { | ||
+ | document.getElementById(' | ||
+ | } | ||
+ | |||
+ | function onFeatureClick(feature) | ||
+ | { | ||
+ | } | ||
+ | init(); | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | * http:// | ||
+ | * http:// | ||
+ | * Google Maps kostenpflichtig: | ||