The IDLffShape::GetEntity function method returns the entities you specify from a Shapefile.
Result = Obj->[IDLffShape::]GetEntity([Index] [, /ALL] [, /ATTRIBUTES])
Returns a type {IDL_SHAPE_ENTITY} structure array. For more information on the structure, see Entities.
| Note |
| Note |
A scalar or array of longs specifying the entities for which you want to retrieve with 0 being the first entity in the Shapefile. If the ALL keyword is set, this argument is not required. If you do not specify any entities and the ALL keyword is not set, the first entity (0) is returned.
Set this keyword to retrieve all entities from the Shapefile. If this keyword is set, the Index argument is not required.
Set this keyword to return the attributes in the entity structure. If not set, the ATTRIBUTES tag in the entity structure will be a null IDL pointer.
In the following example, all of the entities from the states.shp Shapefile are read:
PRO ex_shapefile
; Open the states Shapefile in the examples directory.
myshape=OBJ_NEW('IDLffShape', FILEPATH('states.shp', $
SUBDIR=['examples', 'data']))
; Get the number of entities so we can parse through them.
myshape->IDLffShape::GetProperty, N_ENTITIES=num_ent
; Read all the entities.
FOR x=1, (num_ent-1) DO BEGIN
;Read the entity x
ent = myshape->IDLffShape::GetEntity(x)
;Clean-up of pointers
myshape->IDLffShape::DestroyEntity, ent
ENDFOR
; Close the Shapefile.
OBJ_DESTROY, myshape
END
Introduced: 5.4