[mapserver-users] Mapserver filter/expression by DATE

Jeff McKenna jmckenna at gatewaygeomatics.com
Tue Aug 9 06:00:53 PDT 2016


Hi Daniel,

I think for the thousands of readers on this mailing list, you really 
need to give examples of your psql queries that you are trying (people 
in these open communities find editing your mistakes much easier than 
suggesting new solutions).  So, dive into the commandline :)  Do some 
tests with the tools I mentioned, then come back here and paste in your 
query syntax for the mailing list readers, I bet someone will be able to 
help you then.

-jeff


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



On 2016-08-09 9:54 AM, drobins wrote:
> Hi jeff,
>
> does this apply also if I have different projects from different
> start/enddates?
> Lets say I have 3 projects:
> Project A: 2016-01-01 till 2019-01-01
> Project B: 2017-02-02 till 2022-01-01
> Project C: 2018-03-03 till 2025-05-01
>
> When I check YR2017 I want to see Project A and B but not C
>
> Note that I find it a little difficult to really explain what I'm trying to
> achieve :)
> I guess easiest description would be like being able to scroll
> forward/backwards and depending on where I stop, display everything that is
> active on that current selected date.
>
> Thanks
> -Daniel
>
>
> jmckenna wrote
>> Hello,
>>
>> You can create your query through the commandline tool 'psql', and once
>> you have that working you can test through the 'ogrinfo' commandline
>> tool, using its '-sql' switch.  Then you can test through MapServer with
>> the 'shp2img' commandline tool, by setting that query within the DATA
>> statement of your mapfile layer.  See examples at
>> http://www.mapserver.org/input/vector/postgis.html
>>
>> -jeff
>>
>> --
>> Jeff McKenna
>> MapServer Consulting and Training Services
>> http://www.gatewaygeomatics.com/
>>
>>
>>
>> On 2016-08-09 8:56 AM, drobins wrote:
>>> I have a PostGIS database and I have a column "startdate" and "enddate"
>>> in my
>>> database (YYYY-MM-DD format).
>>> What I want to do is make a filter/expression that checks if a certain
>>> selected date falls between those 2 dates.
>>>
>>> Example:
>>> I have a checkbox for enable/disable the following layers:
>>> 2016
>>> 2017
>>> 2018
>>> 2019
>>> 2020
>>>
>>> I have an entry in my database with:
>>> startdate: 2016-01-01
>>> enddate: 2019-01-01
>>>
>>> If I check the layer 2017, I would like it to check if its between the
>>> start/enddate and if yes, display it.
>>> Is this possible with Mapserver/Openlayers?
>>>
>>>
>>


More information about the mapserver-users mailing list