[mapserver-users] Expressions

Jay Kapalczynski jkapalczynski at ci.maple-grove.mn.us
Tue Sep 21 10:50:55 EDT 2010


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 21st 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-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bob Basques
Sent: Friday, September 17, 2010 9:25 PM
To: mapserver-users at 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 21st 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 at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>

http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100921/031eb60f/attachment-0001.html


More information about the mapserver-users mailing list