[mapserver-users] Expressions

Jeff McKenna jmckenna at gatewaygeomatics.com
Wed Feb 4 08:55:05 PST 2009


Jay Kapalczynski wrote:
> I am trying to do expressions based on a shapefile…I had this working in 
> a prior version but now it wont work…
> 
>  
> 
> The fields GEO_SIMPLE and dateValues exist in the shapefile.
> 
> I have the date values in “dateValues” as TEXT, 8 characters.
> 
>  
> 
> The Star symbols come up but the application freezes up and wont draw 
> the rest of the layers…so I have something wrong…
> 
>  
> 
> Does the date format have to be changed?
> 
> Does the field have to be a date field?
> 
> Will the below format work?  ("%2M%2D%2Y)
> 
>                 But in the field it looks like this *11509*
> 
>  
> 
> If I remove the param types and the expression stuff it draws the layer 
> fine…so it has to be with the dates.
> 
>  
> 
> THANKS IN ADVANCE FOR ANY HELP
> 
>  
> 
> I get this error:
> 
>  
> 
> Strfdate is not defined
> 
>  
> 
> mapParams[i].SetAttribute(‘value’,strfdate(new 
> Date(d.getTime()+offset),formats…………
> 
>  
> 
>  
> 
>  
> 
> *DEMO.XML*
> 
>           <map title="Burglaries" default="true" reference="false" 
> popups="true" data="true">
> 
>                     <param type="today" offset="-7" name="LASTWEEK" 
> format="%2M%2D%2Y"/>
> 
>                     <param type="today" offset="-14" name="LASTTWOWEEKS" 
> format="%2M%2D%2Y"/>
> 
>                     <param type="today" offset="-30" name="LASTTHIRTY" 
> format="%2M%2D%2Y"/>
> 
>                     <param type="today" offset="-90" name="LASTNINTY" 
> format="%2M%2D%2Y"/>
> 
>                     
> <file>/ms4w/apps/GeoMOOSE/Maple_Grove_GeoMoose/Burglaries/Burglaries_8bit.map</file>
> 
>          </map>
> 
>  
> 
>  
> 
>  
> 
> *BURGLARIES.map*
> 
>                                 CLASS
> 
>                                   NAME 'Last Week'
> 
>                                      EXPRESSION ('[GEO_SIMPLE]' = 
> 'BURGLARY' AND '[dateValues]' > '%LASTWEEK%')
> 
>                                        COLOR 197 0 255
> 
>                                        SYMBOL "star"
> 
>                                        SIZE 12
> 
>                                 END
> 
>                                
> 
>                                 CLASS
> 
>                                   NAME 'Last Two Weeks'
> 
>                                   EXPRESSION ('[GEO_SIMPLE]' = 
> 'BURGLARY' AND '[dateValues]' > '%LASTTWOWEEKS%')
> 
>                                   COLOR 255 0 0
> 
>                                   SYMBOL "star"
> 
>                                       SIZE 12
> 
>                                 END
> 
>  
> 
>                                 CLASS
> 
>                                   NAME 'Last Thirty Days'
> 
>                                   EXPRESSION ('[GEO_SIMPLE]' = 
> 'BURGLARY' AND '[dateValues]' > '%LASTTHIRTY%')
> 
>                                   COLOR 0 255 0
> 
>                                   SYMBOL "star"
> 
>                                       SIZE 12
> 
>                                 END
> 
>                                
> 
>                                 CLASS
> 
>                                   NAME 'Last Ninety Days'
> 
>                                   EXPRESSION ('[GEO_SIMPLE]' = 
> 'BURGLARY' AND '[dateValues]' > '%LASTNINTY%')
> 
>                                   COLOR 0 0 255
> 
>                                   SYMBOL "star"
> 
>                                       SIZE 12
> 
>                                 END
> 

The first thing you might try is a shp2img command 
(http://mapserver.org/utilities/shp2img.html) with the -map_debug switch 
(see example on that page) and then report the errors listed in that 
command result to this mapserver-users email list.

-jeff



-- 
Jeff McKenna
FOSS4G Consulting and Training Services
http://www.gatewaygeomatics.com/





More information about the MapServer-users mailing list