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

Home » Public Forums » archive » Re: write array 2 *.shp 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: write array 2 *.shp file [message #61691 is a reply to message #61684] Mon, 28 July 2008 07:13 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> d.poreh@gmail.com writes:
>
>> Here is my code but I have got just one point in the attribute table:
>> =2E.......
>> =2E........
>> mynewshape=3DOBJ_NEW('IDLffShape',file,/UPDATE, ENTITY_TYPE=3D1)
>>
>> mynewshape->AddAttribute, 'lat', 7, 25, $
>> PRECISION=3D0
>> mynewshape->AddAttribute, 'lon', 7, 25, $
>> PRECISION=3D0
>>
>> entNew =3D{IDL_SHAPE_ENTITY}
>> for J=3D0,N-1 do begin
>> entNew.SHAPE_TYPE =3D 1
>> entNew.ISHAPE =3D fix(randomu(10)*10000)
>> entNew.BOUNDS[0]=3D(A[0,j])
>> entNew.BOUNDS[1]=3D( A [1,j])
>> entNew.BOUNDS[2]=3D0.00000000
>> entNew.BOUNDS[3]=3D0.00000000
>> entNew.BOUNDS[4]=3D( A [0,j])
>> entNew.BOUNDS[5]=3D( A [1,j])
>> entNew.BOUNDS[6]=3D0.00000000
>> entNew.BOUNDS[7]=3D0.00000000
>> entNew.N_VERTICES =3D 1
>> endfor
>>
>> attrNew =3D mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)
>>
>> mynewshape -> PutEntity,entNew
>> mynewshape -> SetAttributes, 0, attrNew
>>
>> OBJ_DESTROY, mynewshape
>
> I'm not surprised. I would try adding a loop if
> you wanted to add others. :-)

Oh, sorry. I didn't read closely enough. You do have
a loop. But your entNew entity structure is not a part
of it. It should be. You need to create a new entity
each time through the loop, and you need to add it
to the shapefile each time through the loop. Your problem
is that your loop doesn't emcompass everything you need
to do in the loop.

You are making one entity and filling that up with different
stuff over and over, before you save that single entity in
your file. You want to make MULTIPLE entities and save
those.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Finding the Top Two Most Common Coordinates in a Multi-Dimensional Array
Next Topic: Software Package Free! ... about our Free Software

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

Current Time: Sat Oct 18 09:28:39 PDT 2025

Total time taken to generate the page: 0.01735 seconds