[OpenLayers-Users] How may I use transform ?

Pierre Muckensturm pierre at georezo.net
Thu Dec 22 10:15:31 EST 2011


Hi,
My php write this in the javascript :

<script type='text/javascript'>
      var map;
	  function init() {
        map = new OpenLayers.Map("map_id", {});
        //map.addControl(new OpenLayers.Control.MousePosition());
        var osm_layer = new OpenLayers.Layer.OSM();
        map.addLayer(osm_layer);

        map.zoomToExtent(new OpenLayers.Bounds(446909,6316526,451696,6318943));
		map.zoomToScale(12000);
//		map.events.register("mousemove", map, function(e) {
//			var position = this.events.getMousePosition(e);
//			OpenLayers.Util.getElement("coords").innerHTML = position;
//		});
		var markers = new OpenLayers.Layer.Markers( "Markers" );
		map.addLayer(markers);
		var size = new OpenLayers.Size(125,26);
		var size2 = new OpenLayers.Size(12,26);
		var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
		var offset2 = new OpenLayers.Pixel(0,0);
		var icon = new OpenLayers.Icon('./galerie/logo-small.png',size,offset);
		markers.addMarker(new OpenLayers.Marker(new
OpenLayers.LonLat(448835,6318174),icon));
		var halfIcon = icon.clone();
		var icon2 = new OpenLayers.Icon('./galerie/icon_marker.png',size2,offset2);

		//recupération des coordonnées des centroides depuis la base oracle
en EPSG:2154 et transformation en EPSG:900913
		markers.addMarker(new
OpenLayers.Marker(OpenLayers.Projection.transform(OpenLayers.Point(775133.95,6907235.95),
EPSG:2154,EPSG:900913),icon2);
[...]
};
		
    </script>

Is the markers.addMarker(...transform...); correct ?

The map is still blank.

Thanks in advance for any advice you'll give to a noob.
-- 
PLM aka Brindavoine


More information about the Users mailing list