[OpenLayers-Users] Set extent for mapserver's layer with
gmap(Chen kuja)
Chen kuja
eiclkun at gmail.com
Tue May 13 10:14:08 EDT 2008
Thanks for the better code. But things getting weird here. my mapfile
displayed pretty well as epsg900913(i can see the different from epsg 4326)
under the "map.setCenter(new
OpenLayers.LonLat(12728934.108387556,3564373.2839840306), 15);" -- as it
should be, it's 900913. However, as for the gmap, it seems require "
map.setCenter(new OpenLayers.LonLat( 114.350503, 30.475874), 10);" --- the
normal lon&lat, not google's own coordinate system. It dizzied my for hours.
with this, it is impossible for me to integrate those two map.
I can't find much example like local mapserver file and gmap, so I wonder in
which steps i did wrong?
here is the code
<script type="text/javascript">
var map, layer;
function init() {
var options = {
projection : "EPSG:900913",
maxExtent : new OpenLayers.Bounds(-120037508.34,
-120037508.34, 120037508.34, 120037508.34),
// maxExtent : new OpenLayers.Bounds(12727216.047735045,
3563238.963082024, 12731224.662598498, 3566021.113954254),
maxResolution : 156543.0339,
maxZoomLevel : 35,
numZoomLevels : 35,
units : "m",
controls : []
};
map = new OpenLayers.Map( 'map',options);
// var base = new OpenLayers.Layer.MapServer( "Base Layer", "
http://127.1/cgi-bin/mapserv.exe?",
var gsat = new OpenLayers.Layer.Google("Google Satellite",
{type: G_SATELLITE_MAP, },{'sphericalMercator': true});
// var gsat = new OpenLayers.Layer.Google("Google
Satellite",{type: G_SATELLITE_MAP, });
map.addLayers([gsat]);
// map.addLayers([gsat]);
map.addControl(new OpenLayers.Control.PanZoomBar(), new
OpenLayers.Pixel(2,30));
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.MouseDefaults());
map.addControl(new
OpenLayers.Control.MousePosition({element:document.getElementById("rota"),
numdigits:3}));
// map.setCenter(new
OpenLayers.LonLat(12728934.108387556,3564373.2839840306), 15);
map.setCenter(new OpenLayers.LonLat( 114.350503, 30.475874), 10);
};
</script>
ps. Last afternoon, a earthquake stroke South Sichuan, China. It's about
1000km away from my university, but still I can felt the terrible shaking
for 1 minute. It even spread to my home in Shanghai. I spent 3 hours, tyring
to call my friends in Chengdu&Chongqing. Luckily, they are all alright. But
I know , 10 thousands had died, more still buried. GOD BLESS THEM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080513/67f1bcc8/attachment.html
More information about the Users
mailing list