IDLffShape::GetProperty

The IDLffShape::GetProperty procedure method returns the values of properties associated with a Shapefile object. These properties are:

Syntax

Obj->[IDLffShape::]GetProperty [, PROPERTY=variable]

Arguments

None

Keywords

Any property listed under IDLffShape Properties that contains the word “Yes” in the “Get” column of the properties table can be retrieved using this method. To retrieve the value of a property, specify the property name as a keyword set equal to a named variable that will contain the value of the property.

Examples

In the following example, the number of entities and the entity type is returned:

PRO entity_info

 

; Open the states Shapefile in the examples directory.

myshape=OBJ_NEW('IDLffShape', FILEPATH('states.shp', $

   SUBDIR=['examples', 'data']))

 

; Get the number of entities and the entity type.

myshape->GetProperty, N_ENTITIES=num_ent, $

   ENTITY_TYPE=ent_type

 

; Print the number of entities and the type.

PRINT, 'Number of Entities: ', num_ent

PRINT, 'Entity Type: ', ent_type

 

; Close the Shapefile.

OBJ_DESTROY, myshape

 

END

This results in the following:

Number of Entities:       51

Entity Type:               5

In the next example, the definitions for attribute 1 are returned:

PRO attribute_info

 

; Open the states Shapefile in the examples directory.

myshape=OBJ_NEW('IDLffShape', FILEPATH('states.shp', $

   SUBDIR=['examples', 'data']))

 

; Get the info for all attribute.

myshape->GetProperty, ATTRIBUTE_INFO=attr_info

 

; Print Attribute Info.

PRINT, 'Attribute Number: ', '1'

PRINT, 'Attribute Name: ', attr_info[1].name

PRINT, 'Attribute Type: ', attr_info[1].type

PRINT, 'Attribute Width: ', attr_info[1].width

PRINT, 'Attribute Precision: ', attr_info[1].precision

 

; Close the Shapefile.

OBJ_DESTROY, myshape

 

END

This results in the following:

Attribute Number:           1

Attribute Name:    STATE_NAME

Attribute Type:             7

Attribute Width:           25

Attribute Precision:        0

Version History

5.4

Introduced