IDLffShape::PutEntity

The IDLffShape::PutEntity procedure method inserts an entity into the Shapefile object. The entity must be in the proper structure. For more information on the structure, see Entities.

Note: The shape type of the new entity must be the same as the shape type defined for the Shapefile. If the shape type has not been defined for the Shapefile using the ENTITY_TYPE keyword for the IDLffShape::Open or IDLffShape::Init methods, the first entity that is inserted into the Shapefile defines the type.

Note: Only new entities can be inserted into a Shapefile. Existing entities cannot be updated.

Syntax

Obj->[IDLffShape::]PutEntity, Data

Arguments

Data

A scalar or an array of entity structures.

Keywords

None

Examples

In the following example, we create a new shapefile, define a new entity, and then use the PutEntity method to insert it into the new file:

PRO ex_shapefile_putentity

 

; Create the new shapefile and define the entity type to Point.

mynewshape=OBJ_NEW('IDLffShape', DIALOG_PICKFILE(FILE='shape_entity.shp', /WRITE), $

    /UPDATE, ENTITY_TYPE=1)

 

; Create structure for new entity.

entNew = {IDL_SHAPE_ENTITY}

 

; Define the values for the new entity.

entNew.SHAPE_TYPE = 1

entNew.BOUNDS[0] = -104.87270

entNew.BOUNDS[1] = 39.768040

entNew.BOUNDS[2] = 0.00000000

entNew.BOUNDS[3] = 0.00000000

entNew.BOUNDS[4] = -104.87270

entNew.BOUNDS[5] = 39.768040

entNew.BOUNDS[6] = 0.00000000

entNew.BOUNDS[7] = 0.00000000

 

; Add the new entity to new shapefile.

mynewshape->PutEntity, entNew

 

; Close the shapefile

mynewshape->Close

 

; Close the shapefile.

OBJ_DESTROY, mynewshape

 

END

Version History

5.4

Introduced