Very very thanks. It worked fine. but one strange point: Why they don't easily compute this maxRsolution in their lib using with of map element (instead of supposing all map elements to be in 256*256 size)? Anyway, your helpful point is totally appreciated.
________________________________ From: Arnd Wippermann <[email protected]> To: Saka Royban <[email protected]> Cc: [email protected] Sent: Thu, June 9, 2011 1:59:10 AM Subject: AW: [mapserver-users] Problem in extent using openlayers withMapserver when you request MapServer via Url, then Mapserver delivers the image as defined by the mapfile (extent, imagesize) => resolution = 0.45. If you request MapServer via OpenLayers.WMS, then the mapoptions are the point. By default is the maxResolution = 1.40625 and the other resolutions are maxResolution/2^zoom. (1.40625 , 0.703125, 0.3515625, ...) map.zoomToMaxExtent() uses the resolution = 0.703125, because that is the best resolution to display maxExtent (-180,-90,180,90). For the next resolution the map would not display in whole. You can set maxResolution=0.45 in the mapoptions. Then the layer should fill the whole map. Arnd ________________________________ Von: [email protected] [mailto:[email protected]] Im Auftrag von Saka Royban Gesendet: Mittwoch, 8. Juni 2011 15:10 An: MapServer Betreff: Re: [mapserver-users] Problem in extent using openlayers withMapserver ----- Forwarded Message ---- From: Saka Royban <[email protected]> To: Stephen Woodbridge <[email protected]> Sent: Wed, June 8, 2011 5:38:17 PM Subject: Re: [mapserver-users] Problem in extent using openlayers with Mapserver Thanks stephen for ur help (and sorry for bit abit latency in reply) I've already tried that, i.e. constructing map object without any argument but no result. In fact, in first step i created map without any extra argument and faced that problem and after that i added some arguments to maybe solve the problem. Any idea now? ________________________________ From: Stephen Woodbridge <[email protected]> To: [email protected] Sent: Sat, June 4, 2011 10:04:29 PM Subject: Re: [mapserver-users] Problem in extent using openlayers with Mapserver try just using: map = new OpenLayers.Map( 'map' ); -Steve On 6/4/2011 1:21 PM, Saka Royban wrote: > Hi all. > I've really got stuck in this problem and need some help as i'm a newbie > using openlayers with mapserver. > In mapfile i've set output to be: > EXTENT -180 -90 180 90 # Geographic > SIZE 800 400 > IMAGECOLOR 128 128 255 > > when i request mapserver through URL, i recieve a complete 800*400 > image, but when i use openlayers i get a 800*400 image which original > map fills 512*256 of the center and other pixels are filled with IMAGECOLOR. > this is my code: > map = new OpenLayers.Map( 'map',{'tileSize': new > OpenLayers.Size(400,400)} ); > layer = new OpenLayers.Layer.MapServer( "World Map", > "http://localhost/cgi-bin/mapserv.exe", {map: > '/ms4w/apps/ms101/htdocs/ms101.map',layers: 'world_poly', height: 400, > width: 800}, {singleTile: true} ); > > map.addLayer(layer); > map.zoomToMaxExtent(); > > I asked this question in openlayers mailing list with no success. It > sounds it is related to mapserver. > Any help would be greatly appreciated > > Regards (also sorry if my english is not very good) > > > > _______________________________________________ > mapserver-users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
