AnsweredAssumed Answered

Looping in Geospatial Modeling Environment (GME) for Kernel Density Home Ranges

Question asked by scottfields226 on Sep 19, 2017

I am trying to do kernel density home range estimates. I am able to create KDE's, isopleths, and polygon files in GME (geospatial modeling environment) when each animal has its own shapefile. I also figured out how to create a loop to generate a KDE raster file for each animal in my master telemetry file.

However, I have not been able to get a loop to work to create the isopleths and polygons. Also, it generates each animal in a separate shapefile. Therefore, it would be very tedious to go through a multitude of shapefiles to combine the area of each polygon.

Is there a more straight forward way to do this (i.e. a loop that would create the KDE and Isopleths, and then combine the polygons for each animal into a single shapefile)?

The code that I have used to successfully create the required data for a single animal from a single shapefile is listed here:

isopleth(in="C:\Users\ScottF\Desktop\SparrowAnalysis\t1k", out="C:\Users\ScottF\Desktop\ SparrowAnalysis\t1iso95a.shp", quantiles=95, poly="C:\Users\ScottF\Desktop\SparrowAnalysis \t1poly95a.shp"); addarea(in="t1poly95a.shp",area="AREA");

However, this is very tedious as I have over 300 animals. Therefore, I figured out how to write a loop to create a KDE for each animal using a single shapefile that includes every animal (this code is listed below). This works, however, it outputs a single file for each. Therefore, I am stuck trying to write a loop for the code listed above. I can only get a loop to work for the code listed below. I essentially need a loop for the above code, that would output each polygon in a single shapefile.

for(i in 1:5){ kde(in="SparrowPoints.shp", out=paste("kde_",i,".img"), bandwidth="SCV", cellsize=20, where=paste("Sparrow_ID=", i)); };

Outcomes