Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is it possible to find if table has layer Or print list of layers? Edit:: I have a table when I selete some data from table like:

Select * from earth where population >100

Then it create new table but if want to hide layer closing table would not work so to hide layer I need to know table that are used to create layer?

I am a little unclear as to what you want to achieve. Are you wanting to find out which tables have spatial objects? Or if the table is in a map window? –  James S Jul 4 '11 at 13:30
Can you please 'Accept' some of your previous answers. Thanks –  Mapperz Jul 4 '11 at 13:54
@Mapperz Ofcourse I will :) –  kinkajou Jul 4 '11 at 14:39
@James I have edited –  kinkajou Jul 4 '11 at 14:49

2 Answers 2

up vote 2 down vote accepted

If I understand you correctly, I think you want to be able to find out in MapBasic what table a query is based on.

In your queries I would advise adding the into clause to the end of the select statement so you know what the table name is you are dealing with. For eg.

Select * from earth where population >100 into qryName

To determine whether a table is a query or not, you can use the following:

Print TableInfo(qryName, TAB_INFO_TYPE)

If this returns 1 its a base table and if it returns 2 the table is a query.

If the layer is a query, then you can use

Print TableInfo(qryName, TAB_INFO_MAPPABLE_TABLE)

This will tell you which layer the query is based on. But it only works with mappable queries. This is from the MapBasic reference guide:

String result indicating the name of the table containing graphical objects. Use this code when you are working with a table that is actually a relational join of two other tables, and you need to know the name of the base table that contains the graphical objects.

I think for you case this should be fine.

Thanks @James Do you mean a query(table) is layer if it is mappable ? –  kinkajou Jul 4 '11 at 15:49
In MapInfo you use tables. Tables can be mappable (ie have spatial data). If you add a mappable table to a map window, it becomes a layer in that map window. Query's that have mappable data can also be added as layers to a map window. The layer in the map window will still be based on a MapInfo table. –  James S Jul 4 '11 at 15:59
now I understand :) Thank you very much! –  kinkajou Jul 4 '11 at 17:10

Use Table List via Layer Control enter image description here

thanks for nice answer :) How would I be able to do this using mapbasic –  kinkajou Jul 4 '11 at 14:46

This site is currently not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .