[OpenLayers-Users] OL Zoom Issue - Zoomed in very close, cannot not zoom out

Marco Scheuble mail at marco-scheuble.de
Tue Aug 18 10:27:47 EDT 2009



Hi Paul,

for me your coordinates looks strange.
If the projection is epsg: 4326, I think you have to take lat lon coords.

Instead of using the function map.zoomToExtent(), maybe you can use
map.zoomToMaxExtent()

Marco 



Paul Curran-2 wrote:
> 
> Hi,
> 
> 
> 
> Been struggling with this problem for a little while now any help
> appreciated.
> 
> 
> 
> I can view my map of the UK fine via mapserver however when I view it via
> Openlayers I am zoomed in very close to the map (tree level). I am able to
> zoom in even closer (map becomes blurred) however i cannot zoom out. I
> only
> have one layer in the map file.
> 
> 
> 
> For my bounds I am using the extent from my map file
> 
> 
> 
> Here is my code
> 
> 
> 
>       *var zoom = 10;*
> 
>       var bounds = new OpenLayers.Bounds(0, 0, 660046, 1229782);
> 
>       var map, layer;
> 
> 
> 
> 
> 
>       function init(){
> 
>       map = new OpenLayers.Map('map', { *maxExtent: bounds, numZoomlevels:
> 10* });
> 
>       map.addControl(new OpenLayers.Control.PanZoomBar());
> 
>       map.addControl(new OpenLayers.Control.OverviewMap());
> 
>       map.addControl(new OpenLayers.Control.MousePosition());
> 
>       layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
> 
>       "http://127.0.0.1/cgi-bin/mapserv.exe?", { layers: 'uk', map:
> '/ms4w/apps/openlayers-2.5/data/uk1.map' },
> 
>       { gutter: 15 });
> 
>       map.addLayer(layer);
>       *map.zoomToExtent(bounds);*
> **
> Can anyone see where I am going wrong or have any suggestions?
> 
> 
> Cheers, thanks for any help in advance
> 
> Paul
> 
> p.s.   My mapfile is here
> 
> MAP
> 
>     NAME UK1
>  PROJECTION
>     "init=epsg:4326"
>  END
>     SIZE 1600 1200
>     IMAGECOLOR  153 204 255
>     IMAGETYPE JPEG
>     SHAPEPATH "http://localhost/openlayers/data/"
>     EXTENT  0 0 660046 1229782
>     UNITS DD
> 
> 
>  WEB
>    TEMPLATE "http://localhost/openlayers/examples/test.html"
>    LOG "\ms4w\tmp\ms_tmp\log.txt"
>       IMAGEPATH "\ms4w\tmp\ms_tmp\"
>       IMAGEURL "/ms_tmp/"
>       METADATA
>   'wms_title' "map"
>         'wms_onlineresource' 
> "http://127.0.0.1./cgi-bin/mapserv?map=uk1.map
> "
>       END
>  END
>   LAYER
> 
>     NAME "UK"
>     METADATA
>       'wms_title' "wms_demo"
>     END
>     STATUS DEFAULT
>     TYPE raster
>     TILEINDEX "map"
>     TILEITEM "Location"
>     PROJECTION
>       "init=epsg:4326"
>     END
>     CLASS
>       STYLE
>        COLOR 0 0 0
>       END
>       LABEL
>        COLOR 0 0 0
>        SIZE SMALL
>       END
> 
>     END
> 
>   END
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/OL-Zoom-Issue---Zoomed-in-very-close%2C-cannot-not-zoom-out-tp3466106p3466369.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list