Question about Labels

Daniel Morissette dmorissette at MAPGEARS.COM
Thu Sep 13 10:41:17 EDT 2007


Jelmer Baas wrote:
> 
> Hmm, so this means I'll have to detect whether or not a .TAB file has a 
> labels or not? I'm not sure if this would be per item, or per .TAB file 
> / layer?
> 

Not just that. You need to detect whether a TAB file has *only* labels 
in it. Until ticket 2311 is fixed, any object that is not of type TEXT 
will trigger the error that you got.


> Also, I don't think this detection can be done in MapServer, right? 
> Maybe in MapBasic... Would you happen to have any ideas about that, too?
> 

Well, there is no simple flag to turn on in MapServer if that's what 
you're looking for.

I know that the information is available in the header of the .MAP files 
of TAB datasets, but it's not easily accessible with any tool. Maybe in 
MapBasic, I don't know.

The MITAB library (http://mitab.maptools.org/) has access to that 
information in the TABMAPHeaderBlock C++ class, but you'd need to write 
custom C++ code to get it. Well the output of MITAB's "tabdump -a 
file.tab" dumps the values of these members so you could also use "grep" 
on that (look for m_numPointObjects, m_numLineObjects, 
m_numRegionObjects and m_numTextObjects).

A simpler option could be to convert the files to MIF and do an 
automated search using a text editor or some text processing tool... but 
even that's not that simple.

The best of course is to know your data: in that case you'd know which 
files contain labels and which ones don't. We'll forgive you for not 
knowing your data if you tell us you're a programmer and not a 
geographer. ;-)

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/



More information about the mapserver-users mailing list