[OpenLayers-Users] Setting bounds disables map

David Lozzi dlozzi at delphi-ts.com
Tue Oct 13 18:08:47 EDT 2009


Hello,

 

See my code below. When I specify maxExtent: bounds in the new map, my
maps don't appear. All of the added controls appear but no maps. IE
shows download 75 items then down to Done, but there is nothing to see.

 

        var lon = 50;

        var lat = 0;

        var zoom = 0;

        var map, layer;

        var markers;

        var icon;

        

        function init(){

            var bounds = new OpenLayers.Bounds(

                    16617, 777514,

                    348089, 959747

                );

            OpenLayers.DOTS_PER_INCH = 72;

 

            var options = {

                controls: [

                    new OpenLayers.Control.Navigation(),

                    new OpenLayers.Control.PanZoomBar(),

                    new OpenLayers.Control.ScaleLine(),

                    new OpenLayers.Control.MousePosition(),

                    new OpenLayers.Control.LayerSwitcher()

                ],

                numZoomLevels: 20,

                maxExtent: bounds,

                maxResolution: 1294.8125,

                projection: "EPSG:26986",

                units: 'm'

            };

            map = new OpenLayers.Map( 'map',{maxExtent: bounds,
numZoomLevels: 10,controls: [

                    new OpenLayers.Control.Navigation(),

                    new OpenLayers.Control.PanZoomBar(),

                    new OpenLayers.Control.LayerSwitcher()

                ]});

            

            //MassGIS Layers are available at
http://lyceum.massgis.state.ma.us/wiki/doku.php?id=wms:layers

            format = 'image/png';

            

            // setup tiled layer

            tiled = new OpenLayers.Layer.WMS(

                "Roads and Boundaries",
"http://giswebservices.massgis.state.ma.us:80/geoserver/wms",

                {

                    layers:
'massgis:GISDATA.NAVTEQRDS_ARC,massgis:GISDATA.NAVTEQRDS_ARC_STATE'

 

                }

            );

            markers = new OpenLayers.Layer.Markers( "Markers" );

 

            var size = new OpenLayers.Size(10,17);

            var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);

            icon = new
OpenLayers.Icon('/_layouts/DHQMap/img/marker.png',size,offset);

            

            map.addLayers([tiled, markers]);

            map.setCenter(new
OpenLayers.LonLat(-71.1491479425792,42.5394078098106), 14);

        }

 

 

David Lozzi

Product Development Manager

Delphi Technology Solutions, Inc.

(978) 988-8007 x204 - www.delphi-ts.com <http://www.delphi-ts.com/> 

 

Blog <http://www.delphi-ts.com/blogs/lozzi>   -  LinkedIn
<http://www.linkedin.com/in/davidlozzi>   - Twitter
<http://www.twitter.com/davidlozzi>   

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091013/737d649d/attachment.html


More information about the Users mailing list