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

Home » Public Forums » archive » Appending to Shapefile Woes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Appending to Shapefile Woes [message #81162] Thu, 23 August 2012 14:49
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
Folks,

Since I wasted a couple of good hours on this today, I thought I would note it for posterity. I have a new program, cgShapePointFile, that can write a shapefile filled with one or more points as individual entities. An arbitrary number of attributes can be associated with the points.

There was no trouble creating the initial file, but I wanted to be able to append points to this file, as needed. I ran into a interesting problem that took a while to solve. I was opening the file initially like this:

shapefile = Obj_New('IDLffShape', filename, /UPDATE, ENTITY_TYPE=1)

The UPDATE keyword opens the file for writing, and the ENTITY_TYPE
keyword opens it for point data. But, alas, if you open the file like
this when you are trying to append to the file, the "entities" in the
file get wiped out! When you try to find out how many entities are in
the file (so you can get the entity index for the appended entities
right), the file always reports zero entities!

The secret is to remove the ENTITY_TYPE keyword if you want to append
entities to the file:

; Open the shapefile for writing point data.
IF appending THEN BEGIN
shapefile = Obj_New('IDLffShape', filename, /UPDATE)
ENDIF ELSE BEGIN
shapefile = Obj_New('IDLffShape', filename, /UPDATE, ENTITY_TYPE=1)
ENDELSE

I didn't find this documented anywhere, obviously. :-)

Cheers,

David
[Message index]
 
Read Message
Previous Topic: Re: Creating files
Next Topic: How would you measure the range of density on a graph using IDL?

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

Current Time: Wed Oct 08 17:37:18 PDT 2025

Total time taken to generate the page: 0.00436 seconds