Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
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.

share|improve this answer
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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.