[mapserver-users] Can you pass draw scale into postgis SQL?
Stephen Woodbridge
woodbri at swoodbridge.com
Fri Oct 2 14:11:07 PDT 2009
Hi all,
I would like to be able to make my postgis queries in mapserver be aware
of the current draw scale. Is there an easy way to do this in the
mapfile? I would like to avoid parameter substitution since mapserver is
already aware of the scale, it would be nice if we could just embed a
token like [scale] in a mapserver data statement and mapserver would
substitute that for the current draw scale.
DATA "way from (
select way, osm_id, landuse, name
from osm_landuse1 where landuse is not null
and is_large_enough(area(way),'landuse1',[scale])
) as foo using unique osm_id using srid=900913"
The idea here is that is_large_enough(area(way),'landuse1',[scale])
whould return true or false based on comparing area(way) to some value
it looks up for 'landuse1' and the current [scale]. This would allow
dynamic filtering of data in the database based on the current scale.
Likewise you could use the [scale] in a SQL case statement to
dynamically change the SQL results based on scale.
It would seem that this could greatly simplify mapfiles.
-Steve W
More information about the MapServer-users
mailing list