[Geomoose-users] EXPRESSIONS

Jim Klassen Jim.Klassen at ci.stpaul.mn.us
Tue Feb 12 10:54:14 EST 2008


I don't think you can do date/time comparisons using CGI Mapserver. I
think it is just treating the date as a string.

One thing you could do is add a field to the DBF file that stores the
date as an integer encoded as the number of days past a certain time
(say Jan 1 2000) and then you could use the integer comparison methods.
If you regenerate the file often, you could just have the extra column
be the number of days old the record is and not have to pass in the
extra parameter.

I think this is where most people suggest going to a database driven
(PostGIS) data source so you can use a select statement to calculate the
extra column on the fly.

>>> "Jay Kapalczynski" <jkapalczynski at ci.maple-grove.mn.us> 02/12/08
9:35 AM >>>
I narrowed the expression down a bit and got it to work....

 

                                CLASS

                                  NAME 'Last Week'

                                  EXPRESSION ('[Geo_Simple]' =
'BURGLARY')

                                       COLOR 197 0 255

                                       SYMBOL "star"

                                       SIZE 12

                                END

 

So the problem is with the End of the Expression and how it is trying to
calculate dates for "LAST WEEK" , "LAST TWO WEEKS" etc.....

 

The .map file is correct minus the Time/Date and the .xml is
correct....the points show up...I need the date thing to work

 

What code am I missing to calculate the date range....or where that
would be coded?

 

Any thoughts...

 

 

From: Jay Kapalczynski 
Sent: Tuesday, February 12, 2008 8:44 AM
To: 'geomoose-users at lists.sourceforge.net';
geomoose-developers at lists.sourceforge.net
Subject: EXPRESSIONS

 

 

I have been messing around with Expressions and cant seem to get it
right...I am missing something

 

If I eliminate the red line below the Symbols appear on the map...so I
can assume that the problem is with the Expression

 

My shapefile has the two fields below

 

Geo_Simple = Text field with "BURGLARY" as the value for all records

 

Geo_Time = Date Field in this format..."2/8/2008"

 

DOES ANYONE know why the expression is not working....Is there some code
that I am missing???????

 

Am I missing the reference to the %LASTWEEK%????????????

 

THANKS

 

 

IN THE "Burglaries_8bit.map" FILE

 

                LAYER

                                NAME 'BURGLARIES'

                                DATA './Burglaries.shp'

                                TYPE POINT

                                STATUS DEFAULT

 

                                CLASS

                                  NAME 'Last Week'

                                  EXPRESSION ('[Geo_Simple]' =
'BURGLARY' AND '[Geo_Time]' > '%LASTWEEK%')

                                       COLOR 197 0 255

                                       SYMBOL "star"

                                       SIZE 12

                                END         

 

                                HEADER 'header.xml'

                                TEMPLATE 'record.xml'

                                FOOTER 'footer.xml'

 

                END

END ## end Map

 

 

 

IN THE XML FILE

 

         <map title="BURGLARIES" default="true" reference="false"
popups="false" data="false">

                    <param type="today" offset="-7" name="LASTWEEK"
format="%2Y%2M%2D000000"/>

                    <param type="today" offset="-14" name="LASTTWOWEEKS"
format="%2Y%2M%2D000000"/>

                    <param type="today" offset="-30" name="LASTTHIRTY"
format="%2Y%2M%2D000000"/>

                    <param type="today" offset="-90" name="LASTNINTY"
format="%2Y%2M%2D000000"/>

 
<file>/ms4w/apps/GeoMOOSE/maps_statedemo/Burglaries/Burglaries_8bit.map<
/file>

         </map>

 

 

 

WITH THE EXPRESSION:

 

 

 

WITHOUT THE EXPRESSION:

 

 






More information about the Geomoose-users mailing list