[OpenLayers-Users] Markers and Projections

david delannoy david.delannoy at avignon.inra.fr
Fri Apr 13 09:21:57 EDT 2007


Hello,

I'm trying to display markers on a map wich display a layer in 
projection 27582. It seems that it doesn't work while it works for the 
projection 4269. Here is a part of my code.
Thank in advance for your help.

       var llon = 658500;
       var llat = 2380000;

       var options = {
                  maxResolution: "auto",

                  /* maxExtent is the maximum bounds, in the units of 
your map,
                  of the plane in which you want to display information */
                  maxExtent: new 
OpenLayers.Bounds(50000,1586013,1160964,2771788),
                  /* maxExtent is the minimum bounds, in the units of 
your map,
                  of the plane in which you want to display information */
                  minExtent: new 
OpenLayers.Bounds(50000,1586013,1160964,2771788),
                  /* Number of zoom levels */
                  numZoomLevels: 4,
                  /* Unit of geographical values on the map */
                  units : "meters"
                };

          var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
              "http://www.geosignal.org/cgi-bin/wmsmap?SRS=EPSG:27582&",
          {layers: 'RASTER1000k',transparent: "false", format: 
"image/png"}, options);
          map.addLayer(ol_wms);
                    /* Ajout de markers */
          var markers = new OpenLayers.Layer.Markers( "Markers" );
          map.addLayer(markers);

          var size = new OpenLayers.Size(20,30);
          var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
          var icon = new 
OpenLayers.Icon('http://boston.openguides.org/markers/RED.png',size,offset); 

          var marker = new OpenLayers.Marker(new 
OpenLayers.LonLat(llon,llat),icon);
          markers.addMarker(marker);
          marker.events.register('mousedown', marker, function(evt) { 
alert(this.icon.url); Event.stop(evt); });

          map.addControl(new OpenLayers.Control.LayerSwitcher());
          map.zoomToMaxExtent();

-- 
David DELANNOY
Ingénieur en Bioinformatique
Unité Agroclim
Site Agroparc
INRA AVIGNON
david.delannoy at avignon.inra.fr
04 32 72 24 13




More information about the Users mailing list