[OpenLayers-Users] Virtual Earth Issue
willson
talentp1982 at yahoo.com.cn
Wed May 13 05:48:03 EDT 2009
I try to use the "spherical-mercator" example in openlayers/example to
display mycity. I just change the map options "maxResolution" and
"maxExtent". 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.
More information about the Users
mailing list