[OpenLayers-Users] Easy question about adding a map file as a WMS layer from a beginner

zmicjer kozhukh at tut.by
Sat Sep 10 07:34:37 EDT 2011


Hello!
I’ve just started to learn about OpenLayers, MapServer etc.
And I have a question. When I add a Map file as Mapserver layer it works
fine, but when I add it as WMS layer it just displays a background color
(that I have defined in my .map file) and some small unreadable letters. 
Probably you would be so kind to help me to find a mistake in my map file or
in html?
Thanks and sorry for asking such a beginner question.
Here is my mapfile:
MAP
  NAME 'World Map'
  # Map image size
  STATUS ON
  SIZE 600 300
  EXTENT -180.0 -90.0 180.0 90.0
  UNITS dd
  SHAPEPATH 'C://GIS/Data/puvWorld'
  IMAGECOLOR 255 255 255

  
  PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
  END

  # Background color for the map canvas -- change as desired
  IMAGECOLOR 255 0 0
  IMAGEQUALITY 95
  IMAGETYPE png24
  OUTPUTFORMAT
	NAME png
	DRIVER "GD/PNG"
	MIMETYPE "image/png"
	IMAGEMODE PC256
	EXTENSION "png"
  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'           'World Map'
      'wms_onlineresource' 
'http://localhost/cgi-bin/mapserv.exe?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 'world_raster'
    TYPE RASTER
    DATA world_raster.tif
    METADATA
      'wms_title' 'world_raster'
      #'queryable' 'true'
      #'wms_srs'   'EPSG:4326'
    END
    STATUS DEFAULT
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    END
  END

  LAYER
    NAME 'world_adm0'
    TYPE POLYGON
    DATA world_adm0
    METADATA
      'wms_title' 'world_adm0'
      #'queryable' 'true'
      #'wms_srs'   'EPSG:4326'
    END
    STATUS DEFAULT
    TRANSPARENCY 100
    PROJECTION
    'proj=longlat'
    'ellps=WGS84'
    'datum=WGS84'
    'no_defs'
    END
    CLASS
       NAME 'world_adm0'
       STYLE
         SYMBOL 0 
         SIZE 6 
         OUTLINECOLOR 0 0 0
       END
    END
  END

END


And here is my html code:
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    
    
    
  </head>
  <body onLoad="init()">
    <div id="map"></div>
  </body>
</html>

Thank you very much in advance. 
Zmicjer Kožuch


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Easy-question-about-adding-a-map-file-as-a-WMS-layer-from-a-beginner-tp6778573p6778573.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list