[OpenLayers-Users] Markers and Projections
david delannoy
david.delannoy at avignon.inra.fr
Fri Apr 13 10:37:58 EDT 2007
david delannoy a écrit :
> 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();
>
>
Does anybody can help me!? I don't find any informations about that
problem. Which projection do you use with markers? Did you have any
problems with markers on any projection? I'm new in OpenLayers and maybe
I made a big mistake.
Please advice.
Thank you in advance,
Bye
David
--
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