[mapserver-users] .map file wont display in Open Layers

Brent Fraser bfraser at geoanalytic.com
Wed Jul 15 09:53:17 EDT 2009


Paul,

   The PROJECTION in the MAP portion refers to your desired output map 
projection.  It's whatever you want it to be.  The EXTENT values (and UNITS) 
must be relevant for your chosen projection.

Brent Fraser

Paul Curran wrote:
> Thanks for your reply.
>  
>  
>  
> I have set up the IMAGEPATH and IMAGE URL as you have suggested and i 
> can now view the outline of my map however it is in red. As you 
> suggested is is probably my projection which i causing this. Any ideas 
> what the correct projection setting might be?
>  
> Thanks again
>  
> Paul
>  
>>  Date: Mon, 13 Jul 2009 08:17:21 -0600
>>  From: bfraser at geoanalytic.com
>>  To: paul_everton at hotmail.com
>>  CC: mapserver-users at lists.osgeo.org
>>  Subject: Re: [mapserver-users] .map file wont display in Open Layers
>>
>>  Paul,
>>
>>  You may need to define your output projection instead of using "AUTO" (I
>>  didn't know mapserver would tolerate that in the MAP section!).
>>
>>
>>  And IMAGEPATH is the file-system path to a folder writable by 
> mapserver. Here's
>>  an example using standard ms4w:
>>
>>  IMAGEPATH '\ms4w\tmp\ms_tmp\'
>>
>>  with IMAGEURL being its web-based equivalent (the same location on 
> disk but
>>  access via your web server):
>>
>>  IMAGEURL '\ms_tmp\'
>>
>>  since "ms_tmp" is set as an alias in Apache's httd.conf:
>>
>>  Alias /ms_tmp/ "C:/ms4w/tmp/ms_tmp/"
>>
>>
>>  Best Regards,
>>  Brent Fraser
>>
>>
>>  Paul Curran wrote:
>>  > Hi, If anyone can help would be greatly appreciated i have been have
>>  > difficulties displaying my map in Open Layers for little while now.
>>  >
>>  > I have a map file (uk.map) pulling in one layer which is a .shp file
>>  > consisting of .tiff files i created using FWTools.
>>  >
>>  > However i call the .map file from my html page and the map
>>  > will not display in openlayers just a blank screen within the
>>  > Open Layers Window. Can anyone see where i am going wrong?
>>  >
>>  > Here is my map file
>>  >
>>  > MAP
>>  > NAME ukmap
>>  > STATUS ON
>>  > IMAGETYPE PNG
>>  > IMAGECOLOR 153 204 255
>>  > # Map image size
>>  > SIZE 800 800
>>  > UNITS METERS
>>  > EXTENT -888385.321101 -31000.000000 1548385.321101 1271000.000000
>>  > PROJECTION
>>  > "AUTO"
>>  > END
>>  > # Background color for the map canvas -- change as desired
>>  > IMAGECOLOR 192 192 192
>>  > IMAGEQUALITY 95
>>  > IMAGETYPE gif
>>  > OUTPUTFORMAT
>>  > NAME gif
>>  > DRIVER 'GD/GIF'
>>  > MIMETYPE 'image/gif'
>>  > #IMAGEMODE PC256
>>  > EXTENSION 'gif'
>>  > END
>>  > # Legend
>>  > LEGEND
>>  > IMAGECOLOR 255 255 255
>>  > STATUS ON
>>  > KEYSIZE 18 12
>>  > LABEL
>>  > TYPE BITMAP
>>  > SIZE MEDIUM
>>  > COLOR 0 0 89
>>  > END
>>  > END
>>  > # Web interface definition. Only the template parameter
>>  > # is required to display a map. See MapServer documentation
>>  > WEB
>>  > # Set IMAGEPATH to the path where MapServer should
>>  > # write its output.
>>  > IMAGEPATH '/tmp/'
>>  > # Set IMAGEURL to the url that points to IMAGEPATH
>>  > # as defined in your web server configuration
>>  > IMAGEURL '/tmp/'
>>  > # WMS server settings
>>  > METADATA
>>  > 'wms_title' 'ukmap'
>>  > 'wms_onlineresource'
>>  > 'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
>>  > 'wms_srs' 'EPSG:4326'
>>  > END
>>  > #Scale range at which web interface will operate
>>  > # Template and header/footer settings
>>  > # Only the template parameter is required to display a map. See
>>  > MapServer documentation
>>  > END
>>  > LAYER
>>  > NAME 'map'
>>  > TYPE POLYGON
>>  > DATA 'C:\ms4w\apps\openlayers-2.5\data\map.shp'
>>  > METADATA
>>  > 'wms_title' 'map'
>>  > END
>>  > STATUS DEFAULT
>>  > TRANSPARENCY 100
>>  > PROJECTION
>>  > 'proj=longlat'
>>  > 'ellps=WGS84'
>>  > 'datum=WGS84'
>>  > 'no_defs'
>>  > ''
>>  > END
>>  > CLASS
>>  > NAME 'map'
>>  > STYLE
>>  > SYMBOL 0
>>  > SIZE 2
>>  > OUTLINECOLOR 0 0 0
>>  > COLOR 144 50 207
>>  > END
>>  > END
>>  > END
>>  > END
>>  >
>>  > And my html page:
>>  >
>>  > <html xmlns="http://www.w3.org/1999/xhtml">
>>  > <head><B><i>NARIMS MAPPING TEST</i></B>
>>  > <style type="text/css">
>>  > #map {
>>  > width: 800px;
>>  > height: 475px;
>>  > border: 1px solid black;
>>  > }
>>  > </style>
>>  > <script src="../lib/OpenLayers.js"></script>
>>  > <script type="text/javascript">
>>  >
>>  > var lon = 5;
>>  > var lat = 40;
>>  > var zoom = 1;
>>  > var bounds = new OpenLayers.Bounds(-888385.321101, -31000.000000,
>>  > 1548385.321101, 1271000.000000);
>>  > var map, layer;
>>  >
>>  > function init(){
>>  > map = new OpenLayers.Map('map', {maxExtent: bounds});
>>  > map.addControl(new OpenLayers.Control.PanZoomBar());
>>  > map.addControl(new OpenLayers.Control.MouseToolbar());
>>  > map.addControl(new OpenLayers.Control.MousePosition());
>>  > map.addControl(new OpenLayers.Control.OverviewMap());
>>  >
>>  >
>>  > layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
>>  > "http://127.0.0.1/cgi-bin/mapserv.exe", { layers: 'basic', map:
>>  > 'c:/ms4w/apps/openlayers-2.5/data/uk.map' }, { gutter: 15 });
>>  > map.addLayer(layer);
>>  > map.zoomToExtent(bounds);
>>  > map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
>>  >
>>  > }
>>  > </script>
>>  > </head>
>>  > <body onload="init()">
>>  > <div id="map"></div>
>>  > </body>
>>  > </html>
>>  >
>>  >
>>  > Any help much appreciated. Thanks in advance
>>  >
>>  >
>>  >
>>  >
>>  > ------------------------------------------------------------------------
>>  > Upgrade to Internet Explorer 8 Optimised for MSN. Download Now
>>  > <http://extras.uk.msn.com/internet-explorer-8/?ocid=T010MSN07A0716U>
>>  >
>>  >
>>  > ------------------------------------------------------------------------
>>  >
>>  > _______________________________________________
>>  > mapserver-users mailing list
>>  > mapserver-users at lists.osgeo.org
>>  > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> ------------------------------------------------------------------------
> View your Twitter and Flickr updates from one place – Learn more! 
> <http://clk.atdmt.com/UKM/go/137984870/direct/01/>


More information about the mapserver-users mailing list