]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/map.js.erb
Update offset for marker icon to accurately position it
[rails.git] / app / assets / javascripts / map.js.erb
index 1299fb510f23de14cb01a6de9274dba3d28114b9..2749f0ab1325148a979af4a1f82f68a344c890db 100644 (file)
@@ -67,7 +67,6 @@ function createMap(divName, options) {
    markers = new OpenLayers.Layer.Markers("Markers", {
       displayInLayerSwitcher: false,
       numZoomLevels: 20,
-      maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
       projection: "EPSG:900913"
    });
    map.addLayer(markers);
@@ -77,7 +76,7 @@ function createMap(divName, options) {
 
 function getArrowIcon() {
    var size = new OpenLayers.Size(25, 22);
-   var offset = new OpenLayers.Pixel(-30, -27);
+   var offset = new OpenLayers.Pixel(-22, -20);
    var icon = new OpenLayers.Icon("<%= asset_path 'arrow.png' %>", size, offset);
 
    return icon;
@@ -98,8 +97,14 @@ function addMarkerToMap(position, icon, description) {
 }
 
 function addObjectToMap(url, zoom, callback) {
-   var layer = new OpenLayers.Layer.GML("Objects", url, {
-      format: OpenLayers.Format.OSM,
+   var layer = new OpenLayers.Layer.Vector("Objects", {
+      strategies: [ 
+          new OpenLayers.Strategy.Fixed()
+      ],
+      protocol: new OpenLayers.Protocol.HTTP({
+          url: url,
+          format: new OpenLayers.Format.OSM()
+      }),
       style: {
           strokeColor: "blue",
           strokeWidth: 3,
@@ -137,8 +142,6 @@ function addObjectToMap(url, zoom, callback) {
    });
 
    map.addLayer(layer);
-
-   layer.loadGML();
 }
 
 function addBoxToMap(boxbounds, id, outline) {