On Wed, May 13, 2009 at 02:48:03AM -0700, willson wrote: > > I try to use the "spherical-mercator" example in openlayers/example to > display mycity. I just change the map options "maxResolution" and > "maxExtent".
You can't do this -- at least not easily -- with spherical mercator layers. I recommend using 'restrictedExtent' for the latter, and I don't think there's a way to do the former. -- Chris > The question is : the map doesn't display mycity but whole > china, when I zoom in, the map center goes to africa, and the map can't pan. > All seems strange. > Here is the code, any help would be appreciate! > > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <link rel="stylesheet" href="../theme/default/style.css" type="text/css" > /> > <link rel="stylesheet" href="style.css" type="text/css" /> > <style type="text/css"> > .olControlAttribution { bottom: 0px!important } > #map { > height: 512px; > } > </style> > > <script > src="http://dev.ditu.live.com/mapcontrol/mapcontrol.ashx?v=6.1"></script> > > <script src="../lib/OpenLayers.js"></script> > <script type="text/javascript"> > > // make map available for easy debugging > var map; > > // avoid pink tiles > OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3; > OpenLayers.Util.onImageLoadErrorColor = "transparent"; > > function init(){ > var options = { > maxResolution: 0.002805990515625, > maxExtent: new OpenLayers.Bounds(113.03035471400001, > 22.125695214, > 113.74868828599999, 22.844028786) > }; > map = new OpenLayers.Map('map', options); > > > > // create Virtual Earth layers > var veroad = new OpenLayers.Layer.VirtualEarth( > "Virtual Earth Roads", > {'type': VEMapStyle.Road, 'sphericalMercator': true} > ); > var veaer = new OpenLayers.Layer.VirtualEarth( > "Virtual Earth Aerial", > {'type': VEMapStyle.Aerial, 'sphericalMercator': true} > ); > var vehyb = new OpenLayers.Layer.VirtualEarth( > "Virtual Earth Hybrid", > {'type': VEMapStyle.Hybrid, 'sphericalMercator': true} > ); > > > > map.addLayers([veroad, veaer, vehyb]); > map.addControl(new OpenLayers.Control.LayerSwitcher()); > map.addControl(new OpenLayers.Control.EditingToolbar(vector)); > map.addControl(new OpenLayers.Control.Permalink()); > map.addControl(new OpenLayers.Control.MousePosition()); > if (!map.getCenter()) {map.zoomToMaxExtent()} > } > > </script> > </head> > <body onload="init()"> > <h1 id="title">OpenLayers Spherical Mercator Example</h1> > > <div id="tags"> > </div> > > <div id="map" class="smallmap"></div> > > <div id="docs"> > </div> > </body> > </html> > > > > > -- > View this message in context: > http://n2.nabble.com/Virtual-Earth-Issue-tp2880849p2880849.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users -- Christopher Schmidt MetaCarta _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
