[mapserver-users] WFS limit time interval to POSTGIS

Heiko Schröter schroete at iup.physik.uni-bremen.de
Fri Mar 19 04:55:40 EDT 2010


> Hi there,
> 
> There is no explicit support of a TIME parameter in wfs but  I believe 
> It should be possible on a postgis layer to use the FilterEncoding to 
> limit the request: would something like this work for you:
> 
> Filter=<Filter><And><PropertyIsGreaterThan><PropertyName>your_time_field</PropertyName><Literal>2007-01-02</Literal></PropertyIsGreaterThan><PropertyIsLessThan><PropertyName>your_time_field</PropertyName><Literal>2007-01-03</Literal></PropertyIsLessThan></And></Filter>
> 
> 
> regards,

Thanks very much for the suggestion. It does not work that easy (of course ;-) ) but you can filter using the following converting the date to UNIX epochs first and compare the integers.
Unfortunatly the WFS part of MS 5.6.1 does not handle the type 'date' <YYYY-MM-DD> for comparison or calculus.

This works:

http://localhost/cgi-bin/mapserv.patched/?map=/var/www/localhost/mapserver/wfs6_include.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=BRO_V32_TIMED&FILTER=<Filter><And><PropertyIsGreaterThan><PropertyName>date_part('epoch',datum::timestamp without time zone)</PropertyName><Literal>1191359000</Literal></PropertyIsGreaterThan><PropertyIsLessThan><PropertyName>date_part('epoch',datum::timestamp without time zone)</PropertyName><Literal>1191359640</Literal></PropertyIsLessThan></And></Filter>

Still quite ugly to mee.

Is there a deeper reason for not having a time spec within WFS ?

To me you usually have data points in space _and_ time. But i'am not a GEO man either (daily satellite based measurements we have).


Thanks and Regards
Heiko



The LAYER definition is as follows. Funny enough one needs not to specify the FILTER at all ... ok, one learns something new every day:

	LAYER
		EXTENT -180 -90 180 90
		CONNECTIONTYPE POSTGIS
		NAME "BRO_V32_TIMED"
		PROCESSING "CLOSE_CONNECTION=DEFER"
		OPACITY 60
		STATUS ON
		DUMP TRUE
		METADATA
			"wfs_title" "bro_v32_timed"
			"wfs_maxfeatures" "10"
			"gml_featureid" "ID" ## REQUIRED
			"gml_include_items" "all" ## Optional (serves all attributes for layer)
			"gml_geometries" "rechteck"
			"gml_rechteck_type" "polygon"
		END
		PROJECTION
			"init=epsg:4326"
		END
		CONNECTION "user={BF961C25A57BA226} password={C9748CA35D48D049} dbname={6B40E65B12B92106} host=localhost"
		DATA "rechteck from bro_v32_timed using srid=-1 using unique datum"
		TYPE POLYGON
		SIZEUNITS meters
		CLASS
			NAME "bro_v32_timed_total_class"
			STYLE
				OUTLINECOLOR 0 0 0
				COLOR [farbe]
			END
		END
	END # Layer





More information about the mapserver-users mailing list