I'm here again with mi newbie questions. I've been dealing with this issue for 
a long time and I can't fix it no matter how hard I try.
I need to make OL set an initial coordinates and zoom so when I open the 
browser the map stars in some specific part of the world. 

I've done it perfectly with an example doing this:
var options = {
                        minResolution: "auto",
                        minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
                        maxResolution: "auto",
                        maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
                  };

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


            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://labs.metacarta.com/wms/vmap0";, {layers: 'basic'});
            map.addLayer(layer);

            map.setCenter(new OpenLayers.LonLat(-73, 3), 3);
And it works just the way I want, but when I do this with my map:
var options = {
                            minResolution: "auto",
                            minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
                            maxResolution: "auto",
                            maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90)
                 };

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

  
                var request = OpenLayers.Request.GET(
                {url: 
"dir/smms/wms.php?VERSION=1.1.1&REQUEST=GetCapabilities&SERVICE=WMS",
                success: function(response){
                                                var XMLformat = new 
OpenLayers.Format.XML();
                                                var xml = 
XMLformat.read(response.responseText);
                                                var CAPformat = new 
OpenLayers.Format.WMSCapabilities();
                                                var cap = CAPformat.read(xml);
                                         
                                                for (var i=0; 
i<cap.capability.layers.length; i++) {
                                                        layer = 
cap.capability.layers[i];
                                                                                
layers_array[i] = new OpenLayers.Layer.WMS( layer.name, 
                                            "dir/smms/wms.php", 
                                            {'layers': layer.name, format: 
"image/png"}
                                            );
                                                                                
                                                         
                                                 
                                                        
map.addLayer(layers_array[i]);
                                                }
                                                        },
                        failure: function(response){
                                                alert(response.status);
                                                alert("GetCapabilities failed");
                                                        }
                }); 
                                 
                map.setCenter(new OpenLayers.LonLat(-73, 3), 3);

IT DOESN'T WORK, I get the error : maxExtent is null. What can I do??? I hope 
somebody can help me.


      
____________________________________________________________________________________
¡Obtén la mejor experiencia en la web!
Descarga gratis el nuevo Internet Explorer 8. 
http://downloads.yahoo.com/ieak8/?l=e1
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to