Re: [mapserver-users] Can you pass draw scale into postgis SQL?

2009-10-03 Thread Stephen Woodbridge
Open an enhancement request for this. If anyone has any additional 
thoughts on this please add them to the ticket.


Thanks,
  -Steve

Stephen Woodbridge wrote:

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
___
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


[mapserver-users] Can you pass draw scale into postgis SQL?

2009-10-02 Thread Stephen Woodbridge

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
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users