0

Is there a function to get the layer number from the layer name in MapBasic? I am writing a script to loop through each layer I have and apply styles and labelling. Each layer is named _#_LINE or _#_BUFFER

So I was thinking of assigning the layer number as an integer, applying the styles then incrementing the # by one so it moves onto the next layer.

3

You can use LayerInfo to get from a layer name to the matching layer number and vice versa.

Use LAYER_INFO_NUM and LAYER_INFO_NAME.

Also note that you can use a layer number to change the styling of a layer. You don't need the name.

The layer number is unique where you can have multiple layers with the same name (if you have a table in the map multiple times).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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