RE: [mapserver-users] .map file wont display in Open Layers
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: bfra...@geoanalytic.com To: paul_ever...@hotmail.com CC: mapserver-users@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.00 1548385.321101 1271000.00 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; headBiNARIMS 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.00, 1548385.321101, 1271000.00); 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users _ Share your photos with Windows
Re: [mapserver-users] .map file wont display in Open Layers
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: bfra...@geoanalytic.com To: paul_ever...@hotmail.com CC: mapserver-users@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.00 1548385.321101 1271000.00 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; headBiNARIMS 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.00, 1548385.321101, 1271000.00); 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
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.00 1548385.321101 1271000.00 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; headBiNARIMS 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.00, 1548385.321101, 1271000.00); 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@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users