Changeset 5202 in ntrip for trunk/BNC/src


Ignore:
Timestamp:
Jun 10, 2013, 4:10:45 PM (11 years ago)
Author:
mervart
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/map/html/index_osm.html

    r5201 r5202  
    1515
    1616    <script>
     17      var map;
     18      var markers;
     19      var icon; 
     20      var fromProjection;
     21      var toProjection;
     22
    1723      function initialize(lat, lon) {
    1824        map = new OpenLayers.Map("basicMap",
     
    2026                                  new OpenLayers.Control.Navigation(),
    2127                                  new OpenLayers.Control.PanZoomBar()]});
     28        fromProjection = new OpenLayers.Projection("EPSG:4326");   // WGS 1984
     29        toProjection   = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator
    2230
    23         var mapnik         = new OpenLayers.Layer.OSM();
    24         var fromProjection = new OpenLayers.Projection("EPSG:4326");   // WGS 1984
    25         var toProjection   = new OpenLayers.Projection("EPSG:900913"); // Spherical Mercator
    26         var position       = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
    27         var zoom           = 15;
     31        var mapnik   = new OpenLayers.Layer.OSM();
     32        var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
     33        var zoom     = 15;
    2834 
    2935        map.addLayer(mapnik);
    3036
    31         var markers = new OpenLayers.Layer.Markers("Markers");
    3237        var size    = new OpenLayers.Size(40,40);
    3338        var offset  = new OpenLayers.Pixel(-size.w/2, -size.h/2);
    34         var icon    = new OpenLayers.Icon('../html/crosshair.png', size, offset);
     39
     40        icon    = new OpenLayers.Icon('crosshair.png', size, offset);
     41        markers = new OpenLayers.Layer.Markers("Markers");
    3542
    3643        markers.addMarker(new OpenLayers.Marker(position, icon));
     
    4047        map.setCenter(position, zoom);
    4148      }
     49
     50      function gotoLocation(lat, lon) {
     51        var position = new OpenLayers.LonLat(lon, lat).transform(fromProjection, toProjection);
     52        map.setCenter(position);
     53      }
     54
    4255    </script>
    4356
Note: See TracChangeset for help on using the changeset viewer.