[ms4w-users] msEvalRegex(): Regular expression error. String() failed expression test.

Anthony Gangemi gangemia at usq.edu.au
Sun Oct 29 20:12:23 EST 2006


The problem layer is not specified in the returned error message so I
have no idea. If it is a shapefile (layer) causing the problem, then I
assume it will be a case of examining one layer at a time to contain it.

I've pasted my adjusted mapfile here (see below).
I've also put the links to all the related source files at this address:
www.usq.edu.au/users/gangemia/ms/

Regards,

Tony Gangemi
Technical Officer (Surveying & Land Information)
University of Southern Queensland, Toowoomba, Australia 
Faculty of Engineering and Surveying
Email: gangemia[at]@usq.edu.au


Listing 4-1 third.map
---------------------
# This is our third map file
NAME "third"
UNITS DD
EXTENT -180.00 0.00 -60.00 90.00
SIZE 640 480
IMAGECOLOR 189 202 222
IMAGETYPE PNG
SHAPEPATH "/ms4w/apps/firstmap/mapdata/"
FONTSET "/ms4w/apps/firstmap/fonts/font.list"

##################################### 
# Symbol for drawing fat lines
#
SYMBOL
     NAME "BigLine"
     TYPE ELLIPSE
     POINTS 1 1 END
END

##################################### 
# Symbol for drawing dashed lines
#
SYMBOL
     NAME "DashedLine"
     TYPE ELLIPSE
     POINTS 1 1 END
     STYLE 10 10 END   
END

##################################### 
# Symbol for drawing spots
#
SYMBOL
     NAME "Circle"
     FILLED true
     TYPE ellipse
     POINTS 1 1 END
END

##################################### 
# Web object
#
WEB
     TEMPLATE  "c:/ms4w/apps/firstmap/htdocs/third.html"
     IMAGEPATH "c:/ms4w/apps/firstmap/tmp"
     IMAGEURL  "c:/ms4w/tmp/"
END

##################################### 
# Reference map
#
REFERENCE
     IMAGE "c:/ms4w/apps/firstmap/htdocs/third_usaref.gif"
     SIZE 300 225
     EXTENT -180.00 0.00 -60.00 90.00
     STATUS ON
     COLOR -1 -1 -1
     OUTLINECOLOR 255 0 0
END

##################################### 
# Scalebar
#
SCALEBAR
     LABEL
          COLOR 0 0 0 
          ANTIALIAS true
          SIZE small
     END
     POSITION lr
     INTERVALS 5
     STATUS embed
     SIZE 144 5
     STYLE 0
     UNITS miles
     BACKGROUNDCOLOR 255 0 0
     IMAGECOLOR 255 255 255
     COLOR 128 128 128     
     OUTLINECOLOR 0 0 255
     TRANSPARENT off
END

##################################### 
# Legend
#
LEGEND
     STATUS on
     IMAGECOLOR 230 230 230
     LABEL
          TYPE truetype
          FONT "arial"
          COLOR 0 0 0
          SIZE 10
          ANTIALIAS true
     END
END

##################################### 
# State boundaries layer - polygon (for shading)
#
LAYER
     NAME "states"
     DATA "statesp020"
     STATUS on
     TYPE polygon
     LABELCACHE on
     LABELITEM "STATE"
     CLASS
          STYLE
               COLOR 255 246 189
          END
     END
END

##################################### 
# State boundaries layer - line (for fat boundary)
#
LAYER
     NAME "states"
     DATA "statesp020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "STATE"
     CLASS
          NAME "State Line"
          STYLE
               SYMBOL "BigLine"
               SIZE 2
               COLOR 0 0 0
          END
     END
END

##################################### 
# Urban areas layer
#
LAYER
     NAME "urbanareas"
     DATA "urbanap020"
     STATUS on
     TYPE polygon
     LABELCACHE on
     LABELITEM "NAME"
     MAXSCALE 1999999
     CLASS
          STYLE
               COLOR 212 192 100
               OUTLINECOLOR 0 0 0
          END
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 10
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               POSITION auto
          END
     END
END

##################################### 
# hydrographic layer - lakes
#
LAYER
     NAME "lakes"
     DATA "hydrogp020"
     STATUS on
     TYPE polygon
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "FEATURE"
     CLASS
          EXPRESSION ('[FEATURE]' eq 'Lake')
          STYLE
               SIZE 1
               COLOR 189 202 222
               OUTLINECOLOR 0 0 0
          END
          LABEL
               TYPE truetype
               FONT "arial"
               SIZE 8
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               MINDISTANCE 100
               POSITION lr
               MINFEATURESIZE auto
               WRAP ' '
          END
     END
END

##################################### 
# Road layer - interstates only at large scale
#
LAYER
     NAME "interstate1"
     GROUP "roads"
     DATA "roadtrl020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "FEATURE"
     MINSCALE 7500001
     CLASS
          NAME "Interstate Hwy"
          EXPRESSION /Limited Access*/
          STYLE
               SYMBOL "BigLine"
               SIZE 1
               COLOR 0 0 0
          END
          LABEL
               TYPE truetype
               FONT "arial"
               SIZE 8
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               MINDISTANCE 200
               POSITION auto
               ANGLE auto
               MINFEATURESIZE 50
          END
     END
END

##################################### 
# Road layer - interstates only
#
LAYER
     NAME "interstate2"
     GROUP "roads"
     DATA "roadtrl020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "Feature"
     MAXSCALE 7500000
     CLASS
          NAME "Interstate Hwy"
          EXPRESSION /Limited Access*/
          STYLE
               SYMBOL "BigLine"
               SIZE 3
               COLOR 0 0 0
          END
          OVERLAYSYMBOL "DashedLine"
          OVERLAYSIZE 1
          OVERLAYCOLOR 255 255 255
#         TEXT ([FEATURE],[NAME])
          LABEL
               TYPE truetype
               FONT "arial"
               SIZE 8
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               MINDISTANCE 200
               POSITION auto
               ANGLE auto
               MINFEATURESIZE 50
               WRAP ' '
          END
     END
END

##################################### 
# Road layer -  principal highways
#
LAYER
     NAME "principal"
     GROUP "roads"
     DATA "roadtrl020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "Feature"
     MAXSCALE 4000000
     CLASS
          NAME "Principal Hwy"
          EXPRESSION /Principal Highway*/
          STYLE
               SYMBOL "BigLine"
               SIZE 3
               COLOR 197 129 65
          END
          OVERLAYSYMBOL "DashedLine"
          OVERLAYSIZE 1
          OVERLAYCOLOR 255 255 255
#         TEXT ([FEATURE],[NAME])
          LABEL
               TYPE truetype
               FONT "arial"
               MINFEATURESIZE 50
               MINDISTANCE 100
               ANGLE auto
               COLOR 0 0 0
               SIZE 8
          END
     END
END

##################################### 
# Road layer -  other through highways
#
LAYER
     NAME "thru"
     GROUP "roads"
     DATA "roadtrl020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "Feature"
     MAXSCALE 1000000
     CLASS
          NAME "Through Hwy"
          EXPRESSION /Other Through*/
          STYLE
               SYMBOL "BigLine"
               SIZE 3
               COLOR 197 129 65
          END
          OVERLAYSYMBOL "DashedLine"
          OVERLAYSIZE 1
          OVERLAYCOLOR 0 255 0
          LABEL
               TYPE truetype
               FONT "arial"
               MINFEATURESIZE 100
               MINDISTANCE 100
               ANGLE auto
               COLOR 0 0 0
               SIZE 8
          END
     END
END

##################################### 
# Road layer -  other highways
#
LAYER
     NAME "other"
     GROUP "roads"
     DATA "roadtrl020"
     STATUS on
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "FEATURE"
     MAXSCALE 500000
     CLASS
          NAME "Other Hwy"
          EXPRESSION /Other Highway*/
          STYLE
               SYMBOL "BigLine"
               SIZE 2
               COLOR 197 129 65
          END
          LABEL
               TYPE truetype
               FONT "arial"
               ANGLE auto   # requires ttfonts
               MINFEATURESIZE 100
               MINDISTANCE 100
               ANGLE auto
               COLOR 0 0 0
               SIZE 6
          END
     END
END

##################################### 
# Hydrographic layer - streams & rivers
#
LAYER
     NAME "rivers"
     DATA "hydrogl020"
     STATUS DEFAULT
     TYPE line
     LABELCACHE on
     LABELITEM "NAME"
     CLASSITEM "FEATURE"
     MAXSCALE 1000000
     CLASS
          EXPRESSION ('[FEATURE]' eq 'Stream')
          STYLE
               SYMBOL "BigLine"
               SIZE 1
               COLOR 156 182 205
          END
          LABEL
               TYPE truetype
               FONT "arial"
               COLOR 0 0 0
               ANGLE auto
               SIZE 7
               ANTIALIAS true
          END
     END
END

##################################### 
# Cities layer - State capitals and cities pop. > 1000000
# 
LAYER
     NAME "majorcities"
     DATA "citiesx020"
     STATUS default
     TYPE point
     LABELITEM "NAME"
     LABELCACHE on
     LABELMAXSCALE 15000000
     CLASSITEM "FEATURE"
     MINSCALE 2000000
     CLASS
          NAME "State Capitals"
          EXPRESSION /State*/
          STYLE
               SYMBOL "Circle"
               SIZE 6
               COLOR 0 255 0
          END
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 9
               POSITION auto
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
          END
     END
     CLASS
          EXPRESSION ([Pop_2000] > 1000000)
          NAME "Major Cities"
          STYLE
               SYMBOL "Circle"
               SIZE 10
               COLOR 255 0 0
          END
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 10
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               POSITION auto
          END
     END
END

##################################### 
# Cities layer - Large cities, pop. < 1000000
# 
LAYER
     NAME "largecities"
     DATA "citiesx020"
     STATUS default
     TYPE point
     LABELCACHE on
     LABELITEM "NAME"
     MINSCALE 2000000
     CLASS
          EXPRESSION(([Pop_2000]>100000)and([Pop_2000]<=1000000))
          NAME "Cities"
          STYLE
               SYMBOL "Circle"
               SIZE 4
               COLOR 255 0 0
               BACKGROUNDCOLOR 255 0 0
          END
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 8
               POSITION auto
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
          END
     END
END

##################################### 
# City layer - Cities 
LAYER
     NAME "cities"
     DATA "citiesx020"
     STATUS default
     TYPE point
     LABELCACHE on
     LABELITEM "NAME"
     LABELMAXSCALE 500000
     MAXSCALE 2000000
     CLASS
          NAME "Small Cities"
          EXPRESSION ([Pop_2000] < 100000)
          STYLE
               SYMBOL "Circle"
               SIZE 3
               COLOR 255 0 0
          END
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 7
               POSITION auto
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
          END
     END
END

##################################### 
# State boundaries layer - annotation (for labels)
#
LAYER
     NAME "states"
     DATA "statesp020"
     STATUS on
     TYPE annotation
     LABELCACHE on
     LABELITEM "STATE"
     LABELMINSCALE 2000000
     CLASS
          LABEL
               TYPE truetype
               FONT "arialbd"
               SIZE 14			
               OUTLINECOLOR 255 255 255
               COLOR 0 0 0
               MINDISTANCE 200
               MINFEATURESIZE 10
          END
     END
END
END # mapfile


Listing 4-2 The HTML initialization file third_i.map
----------------------------------------------------
<html>
 <head> <title>MapServer Third Map</title></head>
 <body>
  <form method=POST action="/cgi-bin/mapserv.exe">
    <input type="submit" value="Click to initialize">
    <input type="hidden" name="program" value="/cgi-bin/mapserv.exe">
    <input type="hidden" name="map"
value=""c:/ms4w/apps/firstmap/htdocs/third.map">
    <input type="hidden" name="map_web_imagepath" value="/ms4w/tmp/">
    <input type="hidden" name="mapext" value="-180.00 0.00 -60.00
90.00">
    <input type="hidden" name=zoomsize size=2 value=2>
    <input type="hidden" name="layers"
        value="urbanareas lakes states roads capitals">
  </form>
 </body>
</html>


Listing 4-3 The HTML template third.html
----------------------------------------
<html>
<head><title>Third Map</title></head>
<body bgcolor="#E6E6E6">
 <form name="the_form" method=GET action="[program]">
  <table width="100%" border="1">
   <tr><td width="60%" rowspan="6">
       <input name="img" type="image" src="[img]"
               width=640 height=480 border=2>
       </td>
       <td width="40%" align="center" colspan="3">
       <img SRC="[ref]" width=300 height=225 border=1>
       </td>
   </tr>
   <tr><td align="left" colspan="3"><font size="-1">
       Map scale:&nbsp &nbsp &nbsp 1:[scale]</font></td></tr>
   <tr><td align="left" colspan="3"><font size="-1">
       Click x,y:&nbsp &nbsp &nbsp &nbsp [mapx], [mapy]</font></td></tr>
   <tr><td align="left" colspan="3"><font size="-1">
       Map Extent:&nbsp [mapext]</font></td></tr>
   <tr><td><B><center>Legend</center></B></td>
       <td><B><center>Navigation</center></B></td>
       <td><B><center>Layers</center></B></td></tr>
   <tr><td rowspan="2"><img src="[legend]"></td>
       <td align="left"><font size="-1">
       <input type=radio name=zoomdir value=0 [zoomdir_0_check]>
          Pan<BR>
       <input type=radio name=zoomdir value=1 [zoomdir_1_check]>
          Zoom In<BR>
       <input type=radio name=zoomdir value=-1 [zoomdir_-1_check]>
          Zoom Out<BR>
       <input type=text name=zoomsize size=1 value=[zoomsize]>
          Size<BR>
       <center><input type="submit" value="Refresh"></center>
       </td>
       <td align="top">
       <input type="checkbox" name="layer" value="urbanareas"
          [urbanareas_check]>
          Urban Areas<BR>
       <input type="checkbox" name="layer" value="lakes" [lakes_check]>
          Lakes<BR>
       <input type="checkbox" name="layer" value="states"
[states_check]>
          State Boundaries<BR>
       <input type="checkbox" name="layer" value="roads" [roads_check]>
          Roads<BR></font>
       </td>
   </tr>
  </table>
   <input type="hidden" name="imgxy" value="320 240">
   <input type="hidden" name="imgext" value="[mapext]">
   <input type="hidden" name="map" value="[map]">
   <input type="hidden" name="program" value="[program]">
   <input type="hidden" name="map_web_imagepath"
value="[map_web_imagepath]">
 </form>
</body>
</html>

-----Original Message-----
From: ms4w-users-bounces at lists.maptools.org
[mailto:ms4w-users-bounces at lists.maptools.org] On Behalf Of Jeff McKenna
Sent: Friday, 27 October 2006 12:05 am
To: ms4w-users at lists.maptools.org
Subject: Re: [ms4w-users] msEvalRegex(): Regular expression error.
String() failed expression test.

Can you maybe copy the problem layer from the mapfile and paste it into 
this message?  Maybe we'll see something in the layer's expression.

jeff




Anthony Gangemi wrote:
> Hi MS4W Users,
> This is my first question to the mailing list and after my foray into 
> MS4W, I've now hit my first major stumbling block. My system 
> configuration is Windows XP Pro (SP2), MS4W v1.5.5 with MapLab 2.2.1
and 
> Chameleon 2.4 add-on packages. This base installation works well. 
> 
> I'm currently doing the exercises from Bill Kropla's book "Beginning 
> MapServer: Open Source GIS Development". Whilst this book has a slant 
> towards Unix\Linux systems, I can easily make the slight adjustments
in 
> the HTML templates and mapfiles to suit the Windows file system.
Things 
> like the need to include absolute file paths etcetera. I've been able
to 
> use Bill's source code in the book and so far I've achieved success in

> running the chapter 2 and 3 application examples. They are are fairly 
> simple exercises that complement the concepts discussed in the early 
> chapters of this book.
> 
> Now I'm at Chapter 4 of the book and I'm trying to execute it's 
> application example. After making some adjustments to the source code,
I 
> strike this error message which is returned to the browser (using
IE6).
> 
> msEvalRegex(): Regular expression error. String () failed expression
test.
> It looks to be stumbling over an issue with Regular Expressions in the

> mapfile and I cannot see the problem at this stsge.  Hopefully
somebody 
> else has experienced this problem and can provide a solution and/or 
> guidance.
> 
> As a reference, all the source files and map layer's I'm using is
listed 
> below. 
> 
> Beginning MapServer --> the book's sample application source-code:
>
_http://www.apress.com/ApressCorporate/supplement/1/443/1590594908-2868.
zip_ 
> 
> 
> Chapter 4
> Original Source Code    --> 
>
_http://www.usq.edu.au/users/gangemia/mapserver/Chapter4_Code_Original.z
ip_
> My Adjusted Source code --> 
>
_http://www.usq.edu.au/users/gangemia/mapserver/Chapter4_Code_Adjusted.z
ip_
> 
> MapLayer Source: _http://nationalatlas.gov/atlasftp.html_
> citiesx020.tar.gz --> 
> _http://edcftp.cr.usgs.gov/pub/data/nationalatlas/citiesx020.tar.gz_
> roadtrl020.tar.gz --> 
> _http://edcftp.cr.usgs.gov/pub/data/nationalatlas/roadtrl020.tar.gz_
> statesp020.tar.gz --> 
> _http://edcftp.cr.usgs.gov/pub/data/nationalatlas/statesp020.tar.gz_
> hydrogm020.tar.gz --> 
> _http://edcftp.cr.usgs.gov/pub/data/nationalatlas/hydrogm020.tar.gz_
> urbanap020.tar.gz --> 
> _http://edcftp.cr.usgs.gov/pub/data/nationalatlas/urbanap020.tar.gz_
> 
> Regards,
> 
> Tony Gangemi
> University of Southern Queensland, Toowoomba, Australia
> Faculty of Engineering and Surveying
> Email: gangemia[at]usq.edu.au



-- 
Jeff McKenna
DM Solutions Group Inc.
http://www.dmsolutions.ca
_______________________________________________
ms4w-users mailing list
ms4w-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/ms4w-users



More information about the ms4w-users mailing list