Skip to Content.

mget-help - RE: [mget-help] sample polygons

Please Wait...

Subject: Marine Geospatial Ecology Tools (MGET) help

Text archives


From: "Jason Roberts" <>
To: "'Laura McFarlane Tranquilla'" <>
Cc: <>
Subject: RE: [mget-help] sample polygons
Date: Fri, 5 Oct 2012 11:02:39 -0400

Hi Laura,

 

Thanks for the positive feedback about MGET!

 

Unfortunately, although there is a Sample Polygons tool, there is not a Sample Polygons Listed in Fields tool. We may write one at some point but that is not likely to happen in the short term, so let’s see if we can create a workaround for you. Here are some suggestions:

 

1.    Convert the polygons to rasters (use ArcGIS’s built-in batch-processing tools to run Polygon to Raster), then use Sample Rasters Listed in Fields. This is kind of hacky—you have to pick a cell size that is appropriate, considering how likely it is to have points near the edges of the polygons—and might take some time to run, but it would be easy to implement and therefore could the fastest way to get your results.

 

2.    If you have Arc 10, try to build a model that will execute the Sample Polygons tool using Iterate Feature Classes. If you are not familiar with this, one place to start is here. In short: create a model. Right-click the canvas, select iterators, and select Feature Classes. Then drag the Sample Polygons tool onto the canvas. Connect the Feature Class output of the Iterate Feature Classes tool to Sample Polygons, for the Polygon Features parameter. Then drag the points onto the canvas and connect them to the Sample Polygons tool. The crux of this approach is that ALL of the points will be sampled for each iteration—i.e. for each polygon feature class. That is not what you want. You want only SOME of them to be sampled. Therefore you need a way to have the Sample Polygons tool restrict which points it uses each time it is run. One way to do that is with the Sampling Options of that tool. At the very bottom of those, there are parameters called Polygon Fields For Matching and Point Fields For Matching. You need both the points and all of the polygon feature classes to have a field called SamplingDate or something. Then you use that field for matching. Thus, if you have one polygon feature class for March, one for April, one for May, the polygons in the March one need to all have the same value (e.g. 3/1/2012, or maybe just 3 if you are matching just on month), all of the April ones need the same value, etc.

 

3.    A variation of #2 is to not use Iterate Feature Classes but instead Merge all of the polygon feature classes into a single feature class. Then use Sample Polygons as above, with the Polygon Fields For Matching and Point Fields For Matching. The tool knows how to match the March polygons to the March points, etc.

 

#3 is probably how we intended this tool to be used when you had a time series of polygons. Unfortunately I don’t know that our design was very good, as it is often the case that time series of polygons come as separate shapefiles, each with a different date, and without a field specifying the date. For example, sea ice polygons might be issued on a monthly or weekly basis, each in a separate shapefile, with no date field inside. When there is no date field inside, the only place to get the date is from the file name.

 

Thus, to use #3 (or #2 for that matter) you need a way to add a field to a feature class and set the value of a field using that feature class’s name. And you need to batch it. One way to try is with Iterate Feature Classes again. Use it to run Add Field and then run Calculate Field. Iterate Feature Classes outputs the name of the feature class. You can wire that to Calculate Field (or reference it as a variable somehow) so that the field _expression_ is derived from the name.

 

This is pretty complicated stuff. If you’re stumped, try to find a local ArcGIS expert. If nobody’s available, I’ll help if I can, but it may be slow as I have some urgent projects I’m working on now.

 

Best,

 

Jason

 

From: Laura McFarlane Tranquilla [mailto:]
Sent: Friday, October 05, 2012 7:51 AM
To:
Subject: [mget-help] sample polygons

 

Dear MGET,

I am trying to sample a time series of polygons, to determine values for dynamic point data (animal tracking data, over 4 years).  I absolutely love your tool "Spatial Analysis>Sample>Sample Rasters Listed in Fields" and have used it successfully to extract data (rasters of SST, chlorophyll) to points.  However, I am stumped when it comes to performing this same task with a time series of polygons.  Does MGET have a tool that will allow me to "sample polygons listed in fields" and then specify which attribute I wish to sample from each polygon?

thank you so much for any help you can offer,

Laura Tranquilla

--
~~~~~~~~~~~~~~~~~~~~~~~~
Laura McFarlane Tranquilla
PhD Candidate
Cognitive and Behavioural Ecology
Memorial University of Newfoundland
St. John's, NL

Ph:  709-864-7668
Fax: 709-864-2430
Email 1:
Web: http://play.psych.mun.ca/~mont/people.html

 

"...nowadays every albatross has humanity around its neck..."  Carl Safina

 

Archives powered by MHonArc.
Top of Page