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

Home » Public Forums » archive » Re: Shapefile Woes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Shapefile Woes [message #77821] Thu, 06 October 2011 10:43
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> Here are the numbers for IDL 8.1:
>
> loop: 9.566 seconds
> destroy object: 0 seconds
> destroy entities: 0.009 seconds
>
> I guess I could live with that! There must be a lession
> in here somewhere! :-)

Even now most of the time is spent drawing polygons
that are too small to be seen on this global scale.
So, I have added a MinNumVerts keyword to DrawShapes
so that you can set the minimum number of vertices
a polygon has to have to be drawn. With this in
place, this intermediate resolution GSHHS shapefile
renders almost instantaneously. :-)

Sorry to cause so much alarm. ;-)

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Shapefile Woes [message #77822 is a reply to message #77821] Thu, 06 October 2011 10:27 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> My tests are with the gsshs_i_L1.shp file, an intermediate
> resolution file. The Draw Shapes file has loop in which each
> polygon shape in the file is rendered, and then it destroys
> the shapefile object is was using (IDLffShape), and then
> it destroys the entities from the shapefile (these are
> pointers), using Heap_Free. There are 33441 individual
> entities (polygons) in this file.
>
> IDL Print, N_Elements(*entities)
> 33441
> IDL> Heap_Free, entities
>
> I have timed the process in IDL 7.2 and in IDL 8.1.
> Here are the numbers:
>
> IDL 7.2
>
> loop: 0.177 seconds
> destroy object: 0 seconds
> destroy entities: 63.852 seconds
>
> IDL 8.1
>
> loop: 0.193 seconds
> destroy object: 0 seconds
> destroy entities: 90.604 seconds
>
> That is a LONG time to be freeing up pointers!
>
> Interestingly, in several trials in IDL 8.1 the freeing of the
> entities took from a minimum of 65 seconds to a maximum of 102
> seconds. The recorded time was from the first trial.
>
> Does this seem slow to you, or reasonable?

Yowser!! This time I tried freeing up the pointers as
I go. Instead of running through the loop of polygons,
then freeing everything at the last moment with Heap_Free,
I tried this:

FOR j=0,N_Elements(*entities)-1 DO BEGIN
thisEntity = (*entities)[j]
...
Ptr_Free, thisEntity.vertices
Ptr_Free, thisEntity.measure
Ptr_Free, thisEntity.parts
Ptr_Free, thisEntity.part_types
Ptr_Free, thisEntity.attributes
ENDFOR
Obj_Destroy, shapefileObj
Ptr_Free, entities

Here are the numbers for IDL 8.1:

loop: 9.566 seconds
destroy object: 0 seconds
destroy entities: 0.009 seconds

I guess I could live with that! There must be a lession
in here somewhere! :-)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Shapefile Woes [message #77823 is a reply to message #77822] Thu, 06 October 2011 09:52 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> If I use the very lowest resolution shape file in the
> distribution (gsshs_l_L1.shp), then I can draw the
> shapes correctly and IDL has no problems. If I use
> any other resolution file (e.g., gsshs_i_L1.shp), then
> the shapes get drawn in the window, but IDL seems to go
> into an infinite loop after drawing the shapes. Several
> minutes pass before IDL crashes.
>
> Has anyone else experienced problems with these GSHHS
> shapefiles?

OK, something is seriously wrong here, I think. :-)

My tests are with the gsshs_i_L1.shp file, an intermediate
resolution file. The Draw Shapes file has loop in which each
polygon shape in the file is rendered, and then it destroys
the shapefile object is was using (IDLffShape), and then
it destroys the entities from the shapefile (these are
pointers), using Heap_Free. There are 33441 individual
entities (polygons) in this file.

IDL Print, N_Elements(*entities)
33441
IDL> Heap_Free, entities

I have timed the process in IDL 7.2 and in IDL 8.1.
Here are the numbers:

IDL 7.2

loop: 0.177 seconds
destroy object: 0 seconds
destroy entities: 63.852 seconds

IDL 8.1

loop: 0.193 seconds
destroy object: 0 seconds
destroy entities: 90.604 seconds

That is a LONG time to be freeing up pointers!

Interestingly, in several trials in IDL 8.1 the freeing of the
entities took from a minimum of 65 seconds to a maximum of 102
seconds. The recorded time was from the first trial.

Does this seem slow to you, or reasonable?

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Shapefile Woes [message #77824 is a reply to message #77823] Thu, 06 October 2011 09:14 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

> But, already this morning, I have crashed IDL 8.1
> at least half a dozen times just trying to read the
> files and view the shapes.
>
> Has anyone else noticed that IDL 8.1 is extremely
> fragile around shapefiles? There are lots of pointers
> in shapefiles. I wonder if this has something to do
> with the automatic heap clean up procedures?

It is not absolutely clear to me that this is
entirely IDL's fault.

I am using the very latest GSHHS v 2.2.0 (July 15, 2011)
version of the shapefiles.

http://www.ngdc.noaa.gov/mgg/shorelines/gshhs.html

I am trying to read and display the L1 polygon. I am
using the Coyote Library routine DrawShapes to draw
the file:

IDL> Map_Set, /Cylindrical
IDL> DrawShapes, shapefile, Color='sky blue'

If I use the very lowest resolution shape file in the
distribution (gsshs_l_L1.shp), then I can draw the
shapes correctly and IDL has no problems. If I use
any other resolution file (e.g., gsshs_i_L1.shp), then
the shapes get drawn in the window, but IDL seems to go
into an infinite loop after drawing the shapes. Several
minutes pass before IDL crashes.

Has anyone else experienced problems with these GSHHS
shapefiles?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Shapefile Woes
Next Topic: IDL 8.1 Map Projections

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

Current Time: Wed Oct 08 19:39:23 PDT 2025

Total time taken to generate the page: 0.00622 seconds