[OpenLayers-Users] ZoomToMaxExtent ???

Tonton to.tonton at gmail.com
Thu May 6 04:06:48 EDT 2010


hello this is my testpage
the Zoom is not at the boundings i think to set  but a part of it!
So i can not see my map in once   zoom - neither work  :o( ??
the extent i see seems to be (842943, 2334894, 843837, 2335562)

    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <link rel="stylesheet" href="style.css" type="text/css" />
<script src="openlayers/lib/Firebug/firebug.js"></script>
  <script src="openlayers/lib/OpenLayers.js"></script>
        <script type="text/javascript">

            var map = null;
            function init(){
                var bounds = new OpenLayers.Bounds(
                     *   842121.69, 2334085.77, 844655.91, 2336372.63*
                );
                //var size = new OpenLayers.size(w:800 h:600); (not workà
                var options = {
                   maxExtent: bounds,
                    projection: "EPSG:27572",
                    units: 'm',
                };

                map = new OpenLayers.Map('map',options);

                var wms0 = new OpenLayers.Layer.WMS(
                    "Parcelles Edigeo",
                    "
http://geomap/cgi-bin/mapserv?map=/var/www/geomod/test.map&",
                {layers: 'Parcelles',transparent: "true"},
                {buffer: 1, isBaseLayer: true},
                {noMagic: 'true'}
                );

                var wms1 = new OpenLayers.Layer.WMS(
                    "Axe Edigeo",
                    "
http://geomap/cgi-bin/mapserv?map=/var/www/geomod/test.map&",
                {layers: 'Axe',transparent:"true"},
                {isBaseLayer:false},
                {noMagic: 'true'}
                );

                var wms2 = new OpenLayers.Layer.WMS(
                 "Ilots",
                 "
http://geomap/cgi-bin/mapserv?map=/var/www/geomod/test.map&",
                {layers: 'Ilots',transparent: "true"},
                {isBaseLayer:false},
                {noMagic: 'true'}
                );

                var wms3 = new OpenLayers.Layer.WMS(
                    "LabelParcelle Edigeo",
                    "
http://geomap/cgi-bin/mapserv?map=/var/www/geomod/test.map&",
                {layers: 'LabelParcelle',transparent: "true"},
                {isBaseLayer:false},
                {noMagic: 'true'}
                );

                map.addLayers([wms0]);
                map.addLayers([wms2]);
                map.addLayers([wms1]);
                map.addLayers([wms3]);

//ajout l'overview
          var overview = new OpenLayers.Control.OverviewMap({layer:[wms0]});
          map.addControl(overview);

//Ajout le layer switcher

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

//Ajout la position de la souris dans la div mouseposition
        map.addControl (new OpenLayers.Control.MousePosition({
        div: document.getElementById("mouseposition")
        }));
// Zoom Max Extent Marche pas identique a ZoomExtent

     *   map.zoomToMaxExtent();*

        //ajout un Point sur la Carte
        var markersLayer = new OpenLayers.Layer.Markers("Un Point ");
        var iconSize =  new OpenLayers.Size(20,20);
        var iconOffset = new OpenLayers.Pixel(-(iconSize.w/2), -iconSize.h);
        var marker = new OpenLayers.Marker(
        //new OpenLayers.LonLat('5,591','47,97'),
        new OpenLayers.LonLat('842955.67500',' 2335123.73125'),
        new OpenLayers.Icon('img/icons/point.png',iconSize,iconOffset)
        );
        markersLayer.setVisibility(true);
        markersLayer.addMarker(marker);
        map.addLayer(markersLayer);
            }

        </script>
      </head>

      <body onload="init()">
        <div id="map"  style="width: 640px; height: 480px"></div>
<br/><div id="mouseposition"></div>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100506/49837a34/attachment.html


More information about the Users mailing list