Re: Point within country boundary [message #87330 is a reply to message #87329] |
Fri, 24 January 2014 13:36   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Phillip Bitzer writes:
> Well, I guess the question was more or less directed to Matt - since he has the data readily available for testing. I've tried to use ContainsPoints and found it was, um, slow. Inside was much faster, but I wonder if that's me or the routine. /me shrugs
Well, believe it or not, this is nearly instantaneous!
IDL> Print, file
C:\Program Files\Exelis\IDL82\resource\maps\shape\country.shp
IDL> canada = cgExtractShape(file, 'CNTRY_NAME', 'CANADA')
IDL> tic & print, canada -> ContainsPoints(-100, 35) & toc
0
Elapsed Time: 0.001000
IDL> usa = cgExtractShape(file, 'CNTRY_NAME', 'UNITED STATES')
IDL> tic & print, usa -> ContainsPoints(-100, 35) & toc
1
Elapsed Time: 0.000000
Hard to believe, huh!?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|