MS + PostGIS no rows detection?

Jesse Cleary jcleary at EMAIL.UNC.EDU
Wed Jan 25 11:45:26 EST 2006


Hi folks

I'm trying to determine a programmatic method to determine when a 
PostGIS layer query in MapServer returns no rows/empty, beyond not 
seeing the data on the map.  I am setting my FILTER string interactively 
using MapScript - sometimes the user's choice does not return any rows 
from the DB.  In that case, I would like to substitute a small "No Data 
Available" label on the map instead of the data. 

I thought about implementing this through a separate label layer in my 
mapfile, but "no rows" will not return any geometry to use for my "No 
Data" labeling.  I have tried using inline FEATUREs to handle the label 
geometry, querying the DB using the same filter, and setting my class 
expression to detect empty values for any field ( '[field]' = '' ).  
However,  this does not work - I think inline features override the 
DATA, CONNECTION, or FILTER parameters and hence no DB querying takes 
place at all.  

I am open to using PHP/MapScript if that could work better - I could 
then rewrite the label layer DATA string to point to a static "No Data" 
shapefile.  Or perhaps this requires a separate DB table with label-only 
text and geometry, populated with only the empty time slices missing 
from my main geom table?


Hoping there are some clever ideas that I have overlooked.  I'm just not 
able to wrap my head around which option to investigate further.  Thanks 
for any suggestions y'all might have!


Jesse Cleary


MapServer 4.2.5, PostgreSQL 8.0.5, PostGIS 1.0.4-2


-- 
Jesse Cleary				
Department of Marine Sciences	
UNC Chapel Hill

17-6 Venable Hall
jcleary at email.unc.edu
(919) 962-4323



More information about the mapserver-users mailing list