In EXPRESSIONS you can evaluate any of the following:

1. Regular expressions treating the value as a string
2. numeric expressions using booleans like ==,<,>,<=,>=
3. string expressions like ==, !=, and I think strlen()

So if you converted you dates into a format like YYYYMMDD then it would be easy to use a numeric expression like:

EXPRESSION ('[dateValues]' > '%STARTDATE%' && '[dateValues]' < '%ENDDATE%')

or

EXPRESSION ('[dateValues]' > '%STARTDATE%')

where STARTDATE is the YYYYMMDD value of two weeks ago and ENDDATE would be in the same format and allow you to extract record betwee any two start and end dates.

Or you might be able to figure out a complex regular expression the represents the last two weeks like:

EXPRESSION ('[dateValues]' =~ '/%LASTTWOWEEKS%/')

I'm not sure what you would need for the regular expression.

-Steve W

On 9/28/2010 4:23 PM, Jay Kapalczynski wrote:
Anyone have anymore ideas about this….

I have a string field with values

And the code below. The expression does not seem to be running…if I only
use LASTTWOWEEKS it still draws all the points….and I know there are
values in there from 2008

Thanks

*From:* mapserver-users-boun...@lists.osgeo.org
[mailto:mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Jay
Kapalczynski
*Sent:* Tuesday, September 21, 2010 9:51 AM
*To:* 'Bob Basques'; mapserver-users@lists.osgeo.org
*Subject:* RE: [mapserver-users] Expressions

My major question is can I do this with a String/text field? Its the
only way I can see keeping things in a %2Y%2M%2D format ex. 092110 (Sept
21^st 2010), otherwise the 0 will get removed in a numeric field

Can I use the format Year, Month, Day? Or do I have to use Month, Day, Year?

In this example I eliminated two expressions and focused on one
Expression to see if it is working.

*_I kept this_*

<map-source name="Burglaries" type="mapserver">

<file>./maple_grove_datasets/police/Burglaries.map</file>

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

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

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

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

<layer name="Burglaries"/>

</map-source>

*_In my map file I used _**_ONLY_**_ this_*

CLASS

NAME 'Last Weeks'

EXPRESSION ('[dateValues]' > '%LASTTWOWEEKS%')

STYLE

COLOR 0 100 50

SYMBOL "bike"

SIZE 12

END

END

Now in my data I have these values (below), although every symbol was
displayed in the map

NOTE THIS IS A TEXT FIELD

081204, 081225,090118

These values (above) for the Year, Month, Day format specified in the
map source are clearly less than the “last two weeks”, Where as they are
older than the last 14 days….so none of them should show up, but they do

Any thoughts

*From:* mapserver-users-boun...@lists.osgeo.org
[mailto:mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Bob Basques
*Sent:* Friday, September 17, 2010 9:25 PM
*To:* mapserver-users@lists.osgeo.org
*Subject:* Re: [mapserver-users] Expressions

A first stab at seeing more than one class, might be to try and switch
them around order wise, one filter may be overwriting the other for example.

bobb




On 9/17/2010 8:20 AM, Jay Kapalczynski wrote:

I am using GeoMoose but feel this is more a question for Map Server.

I am trying to sort my points by dates using the code below….I think
that I can do this but not sure

Is this a viable format “2Y%2M%2D” ?

As for the field in the shapefile…If I use an integer it removes the 0
from the 092110, (sept 21^st 2010)

If I use a date then there are “/” … 9/21/10

The only way I can see this happening is using a text field with retains
the 0 in 092110

When I use the textfield “dateValues” as seen below I can get the stars
to draw but only the LASTWEEK…for some reason the LASTTWOWEEKS does not
show and I know that I have a few records with dates in the last 14 days…

Thoughts?

THANKS….all your help is very appreciated….

Main .xml file

<map-source name="Burglaries" type="mapserver">

<file>./maple_grove_datasets/police/Burglaries.map</file>

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

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

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

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

<layer name="Burglaries"/>

</map-source>

.map file

CLASS

NAME 'Last Weeks'

EXPRESSION ('[dateValues]' > '%LASTWEEK%')

STYLE

COLOR 0 0 0

SYMBOL "star"

SIZE 12

END

END

CLASS

NAME 'Last Two Weeks'

EXPRESSION ('[dateValues]' > '%LASTTWOWEEKS%')

STYLE

COLOR 0 100 50

SYMBOL "star"

SIZE 12

END

END





_______________________________________________

mapserver-users mailing list

mapserver-users@lists.osgeo.org  <mailto:mapserver-users@lists.osgeo.org>

http://lists.osgeo.org/mailman/listinfo/mapserver-users



_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to