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 #61684 is a reply to message #61681] Mon, 28 July 2008 10:00 Go to previous messageGo to previous message
d.poreh is currently offline  d.poreh
Messages: 406
Registered: October 2007
Senior Member
On 28 Jul., 07:13, David Fanning <n...@dfanning.com> wrote:
> David Fanning writes:
>> d.po...@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.")- Zitierten Text ausblenden -
>
> David
I put multiple structures like this:
……

;Create structure for new entity

entnew=replicate({IDL_SHAPE_ENTITY},N[2])

for J=0,N[2]-1 do begin


; Define the values for the new entity
entnew[j].SHAPE_TYPE = 1
entnew[j].ISHAPE = 1470
entnew[j].BOUNDS[0]=(A[0,j])
entnew[j].BOUNDS[1]=(A[1,j])
entnew[j].BOUNDS[2]=0.00000000
entnew[j].BOUNDS[4]=(A[0,j])
entnew[j].BOUNDS[5]=(A[1,j])
entnew[j].BOUNDS[6]=0.00000000
entnew[j].BOUNDS[7]=0.00000000
entnew[j].N_VERTICES = 1


attrNew = mynewshape ->GetAttributes(/ATTRIBUTE_STRUCTURE)
mynewshape -> PutEntity,entnew[j]

mynewshape -> SetAttributes, 0, attrNew
endfor
;;;;;;;;;;;;;;;;;;;;;;;;;;
But still no result
Cheers
[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 11 05:47:37 PDT 2025

Total time taken to generate the page: 0.94224 seconds