comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » esri shape file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: ESRI shape file [message #72340 is a reply to message #25781] Sat, 28 August 2010 04:31 Go to previous messageGo to previous message
Klemen is currently offline  Klemen
Messages: 80
Registered: July 2009
Member
There is an example of creating a point shape file in Help as Max said
(see below). Creating a polygon is sligtly more difficult; if you need
such an example let me know.
Cheers, Klemen


PRO ex_shapefile_newfile

;Create the new shapefile and define the entity type to Point
mynewshape=OBJ_NEW('IDLffShape', FILEPATH('cities.shp', $
SUBDIR=['examples', 'data']), /UPDATE, ENTITY_TYPE=1)

;Set the attribute definitions for the new Shapefile
mynewshape->AddAttribute, 'CITY_NAME', 7, 25, $
PRECISION=0
mynewshape->AddAttribute, 'STAT_NAME', 7, 25, $
PRECISION=0

;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
entNew.N_VERTICES = 1 ; take out of example, need as workaround

;Create structure for new attributes
attrNew = mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)

;Define the values for the new attributes
attrNew.ATTRIBUTE_0 = 'Denver'
attrNew.ATTRIBUTE_1 = 'Colorado'

;Add the new entity to new shapefile
mynewshape -> PutEntity, entNew

;Note that because this is a new shapefile, the index of
;the new entity is zero.
entity_index=0

;Add the Colorado attributes to new shapefile.
mynewshape -> SetAttributes, entity_index, attrNew

;Close the shapefile
OBJ_DESTROY, mynewshape

END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: A case for lookarounds in StRegEx()
Next Topic: IDL code running error in envi environment(ENVI + IDL)

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:24:30 PDT 2025

Total time taken to generate the page: 0.00389 seconds