new to mapserver - can't get map to display

Adam Quiney aquiney at REFRACTIONS.NET
Fri Oct 28 17:32:12 EDT 2005


Hi Laura,

Without taking too much of a glance at your mapfile, have you tried
using the shp2img utility that comes with mapserver? Running it from a
console (we run using linux), you would type: shp2img -m [path to
mapping file]. If you have any errors in your map file, shp2img will
complain, otherwise it'll spit a bunch of gibberish to your screen for
you (actually an image printed out to console, but for now all you
should need to worry about is whether or not it can actually create an
image from your map file).

This should give you a hand in determining if the problem lies in your
map file or your webpage.

Cheers,

--Adam

Laura Neher wrote:

>Good Afternoon!
>
>
>
>I am new to mapserver and I’m having some problems getting my map to run. I
>suspect the cause is either in the mapfile.map or the webpage.html or both
>but I can’t seem to figure out where it is.
>
>
>
>I have two files that I would like to display. The first is a polygon file
>of census areas that I would like to class based on population density. The
>second is road features. I expect to be adding more to this but I’m just
>trying to get a good start. Below are my mapfile.map and webpage.html
>files. Any assistance on what I’m missing would be greatly appreciated.
>
>
>
>Thanks!
>
>
>
>Laura
>
>
>
>MAPFILE.map
>
>
>
># Start of map file
>
>#
>
>MAP
>
>  NAME MyMap
>
>  STATUS ON
>
>  SIZE 600 450
>
>  # Map extent from ArcMAP dialog "Date Frame Properties > Data Frame"
>
>  EXTENT  -81.77192 46.095211 -80.262369 47.068479
>
>  UNITS DD
>
>  SHAPEPATH "myData"
>
>  TEMPLATEPATTERN "webpage"
>
>  IMAGECOLOR 255 255 255
>
>  IMAGETYPE PNG
>
>
>
>  #
>
>  # Projection definition
>
>  # In most cases, MapServer also works without a detailed definition
>
>  #
>
>  # PROJECTION
>
>  #   "proj=utm"
>
>  #   "ellps=GRS80"
>
>  #   "zone=15"
>
>  #   "north"
>
>  #   "no_defs"
>
>  #   OR:
>
>  #   "init=epsg:26915"
>
>  # END
>
>
>
>  #
>
>  # Start of reference map
>
>  #
>
>  # A full extent image needs to be exported from ArcMap
>
>  # ("File > Export Map... > *.PNG")
>
>  # The size of this image can be changed with an image editing program
>
>  #
>
>  REFERENCE
>
>    # Name of the image file as you saved it
>
>    IMAGE reference.png
>
>    # Extent information from ArcMap dialog "Date Frame Properties > Data
>Frame"
>
>    EXTENT -81.77192 46.095211 -80.262369 47.068479
>
>    # The current size of the image in pixels (see graphics program)
>
>    SIZE 207 196
>
>    STATUS ON
>
>    MINBOXSIZE 5
>
>    MAXBOXSIZE 100
>
>    COLOR -1 -1 -1
>
>    OUTLINECOLOR 128 0 0
>
>    MARKERSIZE 8
>
>    MARKER 'star'
>
>  END
>
>
>
>  #
>
>  # Start of legend
>
>  #
>
>  LEGEND
>
>    KEYSIZE 18 12
>
>    LABEL
>
>      TYPE BITMAP
>
>      SIZE MEDIUM
>
>      COLOR 0 0 89
>
>    END
>
>    STATUS ON
>
>  END
>
>
>
>  #
>
>  # Start of scalebar
>
>  #
>
>  SCALEBAR
>
>    IMAGECOLOR 255 255 255
>
>    LABEL
>
>      COLOR 0 0 0
>
>      SIZE TINY
>
>    END
>
>    STYLE 1
>
>    SIZE 100 2
>
>    COLOR 255 255 255
>
>    UNITS KILOMETERS
>
>    INTERVALS 2
>
>    TRANSPARENT TRUE
>
>    STATUS ON
>
>  END
>
>
>
>  #
>
>  # Start of layer definitions
>
>  #
>
>
>
>  LAYER
>
>    # This layer name has to be identical to the Shapefile name for the
>layer
>
>    # (this is a bug in MapServer)
>
>    NAME Sudbury_populationi
>
>    TYPE POLYGON
>
>    STATUS ON
>
>    # Shapefile name in folder "myData"
>
>    DATA Sudbury_populationi
>
>    # Five classes have been defined for population density
>
>    # Class 1:
>
>    CLASS
>
>      EXPRESSION (([Pop_DEN] > 0) AND ([Pop_DEN] < 45))
>
>      NAME "Population Density 5-44/sqkm"
>
>      STYLE
>
>        OUTLINECOLOR 110 110 110
>
>        COLOR 255 255 204
>
>      END
>
>    END
>
>    # Class 2:
>
>    CLASS
>
>      EXPRESSION (([Pop_DEN] > 44) AND ([Pop_DEN] < 407))
>
>      NAME "Population Density 45-406/sqkm"
>
>       STYLE
>
>       OUTLINECOLOR 110 110 110
>
>        COLOR 194 230 154
>
>      END
>
>    END
>
>    # Class 3:
>
>       CLASS
>
>         EXPRESSION (([Pop_DEN] > 406) AND ([Pop_DEN] < 819))
>
>         NAME "Population Density 407-818/sqkm"
>
>          STYLE
>
>          OUTLINECOLOR 110 110 110
>
>           COLOR 121 199 123
>
>         END
>
>    END
>
>     # Class 4:
>
>        CLASS
>
>          EXPRESSION (([Pop_DEN] > 818) AND ([Pop_DEN] < 1606))
>
>          NAME "Population Density 819-1605/sqkm"
>
>           STYLE
>
>           OUTLINECOLOR 110 110 110
>
>            COLOR 49 163 83
>
>          END
>
>    END
>
>     # Class 5:
>
>        CLASS
>
>          EXPRESSION ([Pop_DEN] < 1605)
>
>          NAME "Population Density 1606-2533/sqkm"
>
>           STYLE
>
>           OUTLINECOLOR 110 110 110
>
>            COLOR 0 105 56
>
>          END
>
>    END
>
>  END
>
>
>
>  LAYER
>
>    # This layer name has to be identical to the Shapefile name for the
>layer
>
>    # (this is a bug in MapServer)
>
>    NAME Major_roads
>
>    # Filename in folder "myData"
>
>    DATA Major_roads
>
>    TYPE LINE
>
>    STATUS ON
>
>    # Only one class:
>
>    CLASS
>
>      NAME Name
>
>      STYLE
>
>        COLOR 255 0 0
>
>      END
>
>    END
>
>    TOLERANCE 3
>
>  END
>
>
>
>END
>
>
>
>
>
>WEBPAGE.HTML
>
>
>
><html>
>
><head>
>
>  <title>MapServer - Sudbury Population Density</title>
>
></head>
>
><body bgcolor="#ffffff">
>
>
>
><!-- Heading: -->
>
><center><h1>MapServer - Sudbury Population Density</h1></center>
>
>
>
><!-- Form for the initialization: -->
>
><p>
>
><form name="demo" method="GET" action="/cgi-bin/mapserv.exe"
>onSubmit="submit_form()">
>
>    <input type="hidden" name="layer" value="Sudbury_populationi">
>
>    <input type="hidden" name="layer" value="Major_roads">
>
>    <input type="hidden" name="zoomsize" value=2>
>
>    <input type="hidden" name="program" value="/cgi-bin/mapserv.exe">
>
>    <input type="hidden" name="map_web_imagepath" value="C:\www\tmp\">
>
>    <input type="hidden" name="map_web_imageurl"
>value="http://herodot.geog.utoronto.ca/tmp/">
>
>    <input type="hidden" name="map_web_template" value="webpage.html">
>
>
>
>    <!-- Edit these two hidden variables: -->
>
>    <input type="hidden" name="map"
>value="C:\www\users\m9050NeL\mapfile.map">
>
>    <input type="hidden" name="root" value="/users/m9050NeL">
>
>
>
>    <input type="submit" value="Initialize">
>
></form>
>
></p>
>
>
>
><hr>
>
><form method="GET" action="[program]" name="mapserv">
>
><center>
>
><table border="0" cellspacing="0" cellpadding="4">
>
><tr>
>
>
>
><!-- Map area: -->
>
><td valign="top" align="center">
>
>  <table width="390" border="0" cellspacing="0" cellpadding="4"
>align="center" bgcolor="#666666">
>
>    <tr>
>
>      <td align="center"><input type="image" name="img" src="[img]"
>width="600" height="450" border="0" alt="This is the map."></td>
>
>    </tr>
>
>    <tr><td bgcolor="#666666">
>
>      <img title="scalebar (km)" alt="scalebar (km)" src="[scalebar]">
>
>    </td></tr>
>
>  </table>
>
></td>
>
>
>
><!-- Navigation/explanation area: -->
>
><td valign="top" bgcolor="#ffffff">
>
>  <table cellpadding="5" cellspacing="0" border="0" bgcolor="#ffffff">
>
>    <tr><td>
>
>      <center><input type="submit" value="Refresh"></center>
>
>
>
>      <!-- Layer selection: -->
>
>      <p>
>
>      <b>Select Layers to Display: </b><br>
>
>      <select multiple name="layer" size=3>
>
>        <option value="sudbury_populationi" [Pop_DEN]> Population Density
>
>        <option value="Major_roads" [Name]> Major Roads
>
>      </select>
>
>
>
>      <!-- Zooming: -->
>
>      <p>
>
>      Zoom In <input type=radio name=zoomdir value=1 [zoomdir_1_check]>
>
>      Pan <input type=radio name=zoomdir value=0 [zoomdir_0_check]>
>
>      Zoom Out <input type=radio name=zoomdir value=-1 [zoomdir_-1_check]>
>
>      <p>
>
>      Zoom Size <input type=text name=zoomsize size=4 value=[zoomsize]>
>
>      <p>
>
>
>
>      <!-- Legend: -->
>
>      <font size=+1><b>Legend</b></font><br><hr>
>
>      <img src="[legend]"><hr>
>
>
>
>      <p>
>
>      <!-- Reference map: -->
>
>      <center><input name="ref" type="image" src="[ref]"
>border="0"></center>
>
>    </td></tr></table>
>
>
>
>  </td></tr>
>
></table>
>
></center>
>
>
>
><!-- Hidden values: -->
>
><input type="hidden" name="mode" value="browse" checked>
>
><input type="hidden" name="imgxy" value="[center]">
>
><input type="hidden" name="imgext" value="[mapext]">
>
><input type="hidden" name="map" value="[map]">
>
><input type="hidden" name="root" value="[root]">
>
><input type="hidden" name="savequery" value="true">
>
><input type="hidden" name="program" value="[program]">
>
><input type="hidden" name="map_web_imagepath" value="[map_web_imagepath]">
>
><input type="hidden" name="map_web_imageurl" value="[map_web_imageurl]">
>
><input type="hidden" name="map_web_template" value="[map_web_template]">
>
></form>
>
>
>
><hr>
>
>
>
><!-- Some information for the user: -->
>
><p>This is a map of the Sudbury CMA region. It blah...</p>
>
>
>
></body>
>
></html>
>
>  
>



More information about the mapserver-users mailing list