[mapserver-users] error in opening mapfile
Suman Chatterjee
schatterjee at addisontx.gov
Mon Jun 22 14:51:12 PDT 2009
Hi all!
I have just started with Mapserver. I have installed the Mapserver from
ms4w. The map server and Apache server is running. I have also
downloaded the Itasca application and copied in the htdocs folder under
Apache. But my problem is I am not able to see the map. It is generating
the error message :
msLoadMap(): Unable to access file. (/mapservdemo/workshop/itasca.map)
I have changed the required IMAGEPATH and IMAGEURL and the hidden
variables in the index.html file which is shown below:
<html>
<head>
<title>MapServer Itasca Application</title>
<script language="javascript">
function configure() {
var template =
document.demo.template.options[document.demo.template.selectedIndex].val
ue;
// EDIT THE NEXT 2 LINES TO MATCH YOUR SETUP
var snippet = "IMAGEPATH 'c:/webdevdata/ms_tmp/'";
snippet += " IMAGEURL '/ms_tmp/'";
snippet += " TEMPLATE " + template;
document.demo.map_web.value = snippet;
if(template.indexOf("frame") != -1) document.demo.action =
"frames.html";
if(template.indexOf("dhtml") != -1) document.demo.action =
"frames_dhtml.html";
}
</script>
</head>
<body bgcolor="#FFFFFF">
<center><h2>MapServer Itasca Application (ms v5.0)</h2></center>
<p><hr><p>
This demonstration application will take you through various levels
of complexity. Starting with a basic application that
allows a user to pan/zoom and change layers we add:
<ul>
<li> dynamically configured scalebars
<li> javascript-based panning
<li> query results to a frame
<li> and finally, a DHTML rubber-band zoom/query capabilty
</ul>
The base data is the old-reliable Itasca dataset that we know and
love...
<!-- EDIT THE FORM ACTION -->
<form name="demo" method="GET" action="/cgi-bin/mapserv.exe"
onSubmit="configure()">
<input type="hidden" name="layer" value="lakespy2">
<input type="hidden" name="layer" value="dlgstln2">
<input type="hidden" name="zoomsize" value=2>
<input type="hidden" name="map_web" value="">
<!-- EDIT THESE HIDDEN VARIABLES -->
<input type="hidden" name="map"
value="/mapservdemo/workshop/itasca.map">
<input type="hidden" name="program" value="/cgi-bin/mapserv.exe">
<input type="hidden" name="root" value="/mapservdemo/workshop">
<select name="template" size="1">
<option value="itasca_basic.html"> Basic Application
<option value="itasca_adds_scalebar.html"> -- Adds
second scalebar
<option value="itasca_adds_pan.html"> -- Adds pan
controls
<option value="itasca_adds_frames.html"> -- Adds
frames
<option value="itasca_adds_dhtml.html"> -- Adds dhtml
rubber-band box
</select>
<input type="submit" value="Initialize"></center>
</form>
<p><hr>
<table width="100%"><tr><td align="right">This site running MapServer
v. 5.0</td></tr></table>
</body>
</html>
The itasca.map file is as below:
#
# Start of map file
#
MAP
NAME ITASCA
STATUS ON
SIZE 600 600
EXTENT 388107.634400379 5203120.88405952 500896.339019834
5310243.30613897
UNITS METERS
SHAPEPATH "C:\ms4w\Apache\htdocs\mapservdemo\workshop\data"
IMAGECOLOR 255 255 255
TEMPLATEPATTERN "itasca"
IMAGETYPE PNG
#
# Projection definition, consult the PROJ.4 documentation for
parameter discussion
#
# PROJECTION
# "proj=utm"
# "ellps=GRS80"
# "zone=15"
# "north"
# "no_defs"
#
# OR:
#
# "init=epsg:26915"
# END
#
# Start of symbol definitions (we're only using a few)
#
SYMBOL
NAME 'circle'
TYPE ELLIPSE
POINTS 1 1 END
FILLED TRUE
END
SYMBOL
NAME 'star'
TYPE VECTOR
FILLED TRUE
POINTS
0 .375
.35 .375
.5 0
.65 .375
1 .375
.75 .625
.875 1
.5 .75
.125 1
.25 .625
END
END
#
# Start of web interface definition (including WMS enabling metadata)
#
WEB
HEADER templates/header.html
TEMPLATE "set in index.html"
FOOTER templates/footer.html
MINSCALE 1000
MAXSCALE 1550000
IMAGEPATH "c:/webdevdata/ms_tmp"
IMAGEURL "/ms_tmp/"
METADATA
WMS_TITLE "UMN MapServer Itasca Demo"
WMS_ABSTRACT "This is a UMN MapServer application for Itasca
County located in north central Minnesota."
WMS_ACCESSCONSTRAINTS "none"
# change this value to match your setup
WMS_ONLINERESOURCE
"http://localhost/mapservdemo/workshop/index.html"
WMS_SRS "EPSG:26915"
END
END
#
# Start of reference map
#
REFERENCE
IMAGE graphics/reference.png
EXTENT 393234.393701263 5205405.16440722 495769.579718949
5307959.02579127
SIZE 120 120
STATUS ON
MINBOXSIZE 5
MAXBOXSIZE 100
COLOR 255 0 0
OUTLINECOLOR 0 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 0 0 0
LABEL
COLOR 255 255 255
SIZE TINY
END
STYLE 1
SIZE 100 2
COLOR 255 255 255
UNITS MILES
INTERVALS 1
TRANSPARENT TRUE
STATUS ON
END
#
# Start of layer definitions
#
LAYER
NAME drgs
TYPE RASTER
STATUS OFF
# OFFSITE 31
OFFSITE 252 252 252
CLASS
NAME 'Digital Raster Graphic'
KEYIMAGE graphics/drgs_keyimage.png
END
METADATA
WMS_TITLE "USGS 1:250,000 Digital Raster Graphic"
WMS_ABSTRACT "Hibbing and Bemidji quadrangles. See
http://deli.dnr.state.mn.us/metadata/full/drgncim1.html for more
information."
WMS_SRS "EPSG:26915"
END
TILEINDEX drgidx
END
LAYER
NAME ctybdpy2
TYPE POLYGON
STATUS DEFAULT
DATA ctybdpy2
# no need for a background IF the USGS quads are being drawn
REQUIRES "![drgs]"
CLASSITEM 'cty_name'
CLASS
EXPRESSION 'Itasca'
STYLE
OUTLINECOLOR 128 128 128
COLOR 225 225 185
END
END
CLASS # every other county in the state
EXPRESSION /./
STYLE
OUTLINECOLOR 128 128 128
COLOR 255 255 255
END
END
METADATA
WMS_TITLE "County Boundary"
WMS_ABSTRACT "Itasca County boundary shapefile. See
http://deli.dnr.state.mn.us/metadata/full/ctybdne2.html for more
information."
WMS_SRS "EPSG:26915"
END
END
LAYER
NAME mcd90py2
GROUP cities
TYPE POLYGON
DATA mcd90py2
STATUS OFF
CLASSITEM city_name
CLASS
NAME "Cities & Towns"
EXPRESSION /./
STYLE
COLOR 255 225 90
END
TEMPLATE "templates/mcd90py2.html"
END
HEADER "templates/mcd90py2_header.html"
FOOTER "templates/mcd90py2_footer.html"
DUMP TRUE # allow GML export
METADATA
WMS_TITLE "Minor Civil Divisions"
WMS_ABSTRACT "Minor civil divisions for Itasca County (boundaries
only)."
WMS_SRS "EPSG:26915"
END
END
LAYER
NAME twprgpy3
TYPE POLYGON
DATA twprgpy3
STATUS OFF
CLASS
NAME 'Townships'
STYLE
SYMBOL 'circle'
SIZE 2
OUTLINECOLOR 181 181 145
END
END
METADATA
WMS_TITLE "Township Boundaries"
WMS_ABSTRACT "Pulic Land Survey (PLS) township boundaries for
Itasca County. See
http://deli.dnr.state.mn.us/metadata/full/twprgne2.html for more
information."
WMS_SRS "EPSG:26915"
END
END
LAYER
NAME lakespy2
TYPE POLYGON
STATUS OFF
DATA lakespy2
CLASS
NAME 'Lakes & Rivers'
TEMPLATE "templates/lakespy2.html"
STYLE
COLOR 49 117 185
END
END
HEADER "templates/lakespy2_header.html"
FOOTER "templates/lakespy2_footer.html"
TOLERANCE 3
DUMP TRUE # allow GML export
METADATA
WMS_TITLE "Lakes and Rivers"
WMS_ABSTRACT "DLG lake and river polygons for Itasca County. See
http://deli.dnr.state.mn.us/metadata/full/dlglkpy2.html for more
information."
WMS_SRS "EPSG:26915"
END
END # lakes
LAYER
NAME dlgstln2
TYPE LINE
STATUS OFF
DATA dlgstln2
CLASS
NAME "Streams"
TEMPLATE "templates/dlgstln2.html"
STYLE
COLOR 49 117 185
END
END
HEADER "templates/dlgstln2_header.html"
FOOTER "templates/dlgstln2_footer.html"
TOLERANCE 5
DUMP TRUE # allow GML export
METADATA
WMS_TITLE "Streams"
WMS_ABSTRACT "DLG streams for Itasca County. See
http://deli.dnr.state.mn.us/metadata/full/dlgstln2.html for more
information."
WMS_SRS "EPSG:26915"
END
END # streams
LAYER
NAME ctyrdln3
GROUP roads
MAXSCALE 300000
STATUS OFF
DATA ctyrdln3
TYPE LINE
CLASS
STYLE
COLOR 0 0 0
END
END
METADATA
WMS_TITLE "County Roads"
WMS_ABSTRACT "County roads (lines only). Derived from MNDOT roads
layer, see http://deli.dnr.state.mn.us/metadata/full/dotrdln2.html for
more information."
WMS_SRS "EPSG:26915"
END
END # county roads
LAYER
NAME ctyrdln3_anno
GROUP roads
MAXSCALE 300000
STATUS OFF
DATA ctyrdln3
TYPE ANNOTATION
LABELITEM "road_name"
CLASS
STYLE
COLOR 255 255 255
SYMBOL 'symbols/ctyhwy.png'
END
LABEL
MINFEATURESIZE 40
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 0
END
END
METADATA
WMS_TITLE "County Roads"
WMS_ABSTRACT "County roads (shields only). Derived from MNDOT
roads layer, see http://deli.dnr.state.mn.us/metadata/full/dotrdln2.html
for more information."
WMS_SRS "EPSG:26915"
END
END # county road annotation
LAYER
NAME majrdln3
GROUP roads
MAXSCALE 600000
STATUS OFF
DATA majrdln3
TYPE LINE
CLASS
NAME "Roads"
STYLE
COLOR 0 0 0
END
END
METADATA
WMS_TITLE "Highways"
WMS_ABSTRACT "Highways- state, US and interstate (lines only).
Derived from MNDOT roads layer, see
http://deli.dnr.state.mn.us/metadata/full/dotrdln2.html for more
information."
WMS_SRS "EPSG:26915"
END
END # highways
LAYER
NAME majrdln3_anno
GROUP roads
MAXSCALE 600000
STATUS OFF
DATA majrdln3
TYPE ANNOTATION
LABELITEM "road_num"
CLASSITEM "road_class"
CLASS
EXPRESSION "3"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL 'symbols/sthwy.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 0
END
END
CLASS
EXPRESSION "2"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL 'symbols/ushwy.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 0 0 0
END
END
CLASS
EXPRESSION "1"
STYLE
COLOR 0 0 0 # dummy color
SYMBOL 'symbols/interstate.png'
END
LABEL
MINFEATURESIZE 50
MINDISTANCE 150
POSITION CC
SIZE TINY
COLOR 255 255 255
END
END
METADATA
WMS_TITLE "Highways"
WMS_ABSTRACT "Highways- state, US and interstate (shields only).
Derived from MNDOT roads layer, see
http://deli.dnr.state.mn.us/metadata/full/dotrdln2.html for more
information."
WMS_SRS "EPSG:26915"
END
END # highway annotation
LAYER
NAME airports
TYPE POINT
DATA airports
STATUS OFF
CLASS
NAME 'Airports'
STYLE
COLOR 128 255 164
SYMBOL 'circle'
SIZE 7
END
TEMPLATE "templates/airports.html"
END
HEADER "templates/airports_header.html"
FOOTER "templates/airports_footer.html"
TOLERANCE 5
METADATA
WMS_TITLE "Airports"
WMS_ABSTRACT "Airport runways for Itasca County."
WMS_SRS "EPSG:26915"
END
END
LAYER
NAME mcd90py2_anno
GROUP cities
TYPE ANNOTATION
DATA mcd90py2
STATUS OFF
LABELITEM "city_name"
CLASSITEM "city_name"
LABELMAXSCALE 500000
CLASS
EXPRESSION /./
LABEL
COLOR 0 0 0
SHADOWCOLOR 218 218 218
SHADOWSIZE 2 2
TYPE BITMAP
SIZE MEDIUM
POSITION CC
PARTIALS FALSE
BUFFER 2
END
END
METADATA
WMS_TITLE "Minor Civil Divisions"
WMS_ABSTRACT "Minor civil divisions for Itasca County (annotation
only)."
WMS_SRS "EPSG:26915"
END
END
END # Map File
I have also changed my httpd.conf file by including the following
lines:
Alias /ms_tmp/ "c:/webdevdata/ms_tmp/"
<Directory "c:/webdevdata/ms_tmp/">
AllowOverride None
Options Indexes FollowSymLinks Multiviews
Order allow,deny
Allow from all
</Directory>
But I am still receiving the same error.
When I am trying to display the Itasca.map file in the browser as below
http://127.0.0.1/cgi-bin/mapserv.exe?map="c:\ms4w\Apache\htdocs\mapservd
emo\workshop\itasca.map
<http://127.0.0.1/cgi-bin/mapserv.exe?map=%22c:\ms4w\Apache\htdocs\mapse
rvdemo\workshop\itasca.map> "
I am getting an error message
msEvalRegex(): Regular expression error. String
("c:\ms4w\Apache\htdocs\mapservdemo\workshop\itasca.map") failed
expression test.
But I can open the map file in text form in the browser without the
mapserver.
I have no idea of what is going wrong? Any help in this regard is
welcome.
Thanks
Suman
*******************************************************************************************************************
This e-mail and any files or attachments transmitted with it contains Information that is confidential and privileged. This document may contain Protected Health Information (PHI) or other information that is intended only for the use of the individual(s) and entity(ies) to whom it is addressed. If you are the intended recipient, further disclosures are prohibited without proper authorization. If you are not the intended recipient, any disclosure, copying, printing, or use of this information is strictly prohibited and possibly a violation of federal or state law and regulations. If you have received this information in error, please delete it and notify Hamid Khaleghipour at 972-450-2868 immediately. Thank you.
*******************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090622/b94b707d/attachment.htm>
More information about the MapServer-users
mailing list