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

Home » Public Forums » archive » Re: IDL - Extracting data from within boundary defined by shapefile
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: IDL - Extracting data from within boundary defined by shapefile [message #73760] Mon, 29 November 2010 23:01 Go to previous message
katie is currently offline  katie
Messages: 3
Registered: November 2010
Junior Member
Thanks for your timely advice! I've never dealt with objects in IDL,
so it took me a while to figure out what you meant, and a while longer
to put it all together, but I think I've got it for the most part.
However, I'm still being held up with the ContainsPoints part. What I
have so far is below.


mrb_shapefile = 'mrb.shp'
mrb_shape = obj_new('IDLffShape',mrb_shapefile)
mrb_shape->IDLffShape::GetProperty, N_ENTITIES=num_ent,
ENTITY_TYPE=ent_type,$
ATTRIBUTE_INFO=attr_info

for i = 0L, (num_ent-1) do begin
ent = mrb_shape -> IDLffShape::GetEntity(i)
x = (*ent.vertices)[0,*]
y = (*ent.vertices)[1,*]
endfor

mrb_roi = obj_new('IDLanROI',x,y)
mrb_points = mrb_roi->IDLanROI::ContainsPoints(lon,lat)

obj_destroy,mrb_shape
obj_destroy,mrb_roi


When I run this, I get the error, "IDLANROI::CONTAINSPOINTS: Number of
LON does not match number of LAT."

The terms lon and lat are the longitudes and latitudes associated with
the soil moisture for the entire globe. There are 64 lat's and 128
lon's. So yes, they do not match, but I'm not sure what else I should
be using in the ContainsPoints function.

Another possible conflict I see here is that the longitudes within x
are negative (for being West), but the longitudes of my soil moisture
data are 0 to 360. Although, when I used MAP_SET to plot my soil
moisture data, and plot the mrb shapefile (using David Fanning's
DRAWSHAPES function) on top of it, it came out fine.

Any suggestions for the lat/lon confusion here?

Many thanks,
Katie


On Nov 27, 6:41 am, Paulo Penteado <pp.pente...@gmail.com> wrote:
> If you mean to select the points that fall into the boundary, you
> could create an IDLanROI, defined by the vertices from the shapefile.
> Then use its containspoints() method to find those inside it. That is,
> assuming that Earth's curvature is not relevant. If it is, you might
> have to change the data from lat/lon to some suitable projection.
>
> On Nov 27, 10:04 am, katie <katie.l.pi...@gmail.com> wrote:
>
>> Hello all,
>
>> I am using IDL 6.1, and was wondering if it's possible to extract data
>> (defined by lat and long gridpoints) from within a boundary defined by
>> a shapefile. For example, I have a contour map of global soil
>> moisture, but would only like to look at the data within the
>> Mississippi River Basin. I have the shapefile for this basin, and have
>> overplotted it onto the contour map so I can see the basin outline and
>> note that it is properly projected on top of my data, but I do not
>> know where to go from there.
>
>> Any advice would be great!
>> Thanks,
>> Katie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Thread-Pool for operators?
Next Topic: Re: Thread-Pool for operators?

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

Current Time: Wed Oct 08 19:42:59 PDT 2025

Total time taken to generate the page: 0.00398 seconds