[OpenLayers-Users] (Openlayers + Mapserver) not able to dispaly
Raster image.
Christopher Schmidt
crschmidt at metacarta.com
Tue Apr 15 15:58:54 EDT 2008
On Tue, Apr 15, 2008 at 12:48:43PM -0700, ptang83 at yahoo.com wrote:
> I used Mapserver + Openlayers. I can load shp data and display it (The image displayed in openlayer is small). However, somehow I am not able to display any raster map even. I only see a blank rectangular on my web browzer. I can use shp2img utility to generate this image. It just didn't display in the openlayer.
"Causing a URL to return content you want is the responsibility of other
software. Causing OpenLayers to load that URL is the responsibility of
OpenLayers."
--
http://trac.openlayers.org/wiki/TroubleshootingTips#Problemswithimagesbeingincorrect
>
> Thanks in advance..
>
>
> I have downloaded ms4w Mapserver and has the following config.
> # Apache 2.2.8
> # PHP 5.2.5
> # mapserv 5.0.2 at /cgi-bin/mapserv.exe
> ===========================
> LOG files show nothing wrong:
> ======================================
> Sun Apr 13 21:57:14 2008,12804,127.0.0.1,nitelti020l,3,-0.000000 -90.000000 180.000000 90.000000,-1.000000 -1.000000,,normal execution
> Sun Apr 13 21:57:14 2008,14076,127.0.0.1,nitelti020l,3,-180.000000 -90.000000 0.000000 90.000000,-1.000000 -1.000000,,normal execution
> =======================================
> MAP file:
> =========================================
> # Map file created from QGIS project file C:/Program Files/Quantum GIS/nitelti020l.qgs
> # Edit this file to customize for your map interface
> MAP
> NAME nitelti020l
> # Map image size
> SIZE 600 600
> UNITS dd
>
> EXTENT -6086744.000000 -5878356.737659 4278894.138000 7580130.593659
> PROJECTION
> 'proj=longlat'
> 'ellps=WGS84'
> 'datum=WGS84'
> 'no_defs'
>
> END
>
> # Background color for the map canvas -- change as desired
> IMAGECOLOR 192 192 192
> IMAGEQUALITY 95
> IMAGETYPE jpeg
> OUTPUTFORMAT
> NAME jpeg
> DRIVER 'GD/JPEG'
> MIMETYPE 'image/jpeg'
> #IMAGEMODE PC256
> EXTENSION 'jpeg'
> 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' 'nitelti020l'
> 'wms_onlineresource' 'http://localhost/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
>
> WEB
> LOG "c:\tmp\mapserv.log"
> END
>
> LAYER
> NAME 'nitelti020l'
> TYPE RASTER
> DATA 'C:\oatdir\nitelti020l.tar\nitelti020l.tif'
> METADATA
> 'wms_title' 'nitelti020l'
> END
> STATUS DEFAULT
> TRANSPARENCY 100
> PROJECTION
> # 'proj=longlat'
> # 'ellps=WGS84'
> # 'datum=WGS84'
> # 'no_defs'
> "init=epsg:4326"
> END
> END
>
> END
>
>
> ==============
> Raster date download
> ==============
> http://edcftp.cr.usgs.gov/pub/data/nationalatlas/nitelti020l.tar.gz
>
> ================
> simple open layer code
> ================
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <style type="text/css">
> #map {
> width: 800px;
> height: 475px;
> border: 1px solid black;
> }
> </style>
> <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
> <script type="text/javascript">
> <!--
> var map, layer;
>
> function init(){
> map = new OpenLayers.Map( 'map' );
> layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS",
> "http://localhost/cgi-bin/mapserv.exe", {map: 'C:/Program Files/ms4w/Apache/htdocs/nitelti020l.map'} );
> map.addLayer(layer);
> map.zoomToMaxExtent();
> }
> // -->
> </script>
> </head>
> <body onload="init()">
> <div id="map"></div>
> </body>
> </html>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list