Minimum Bounding Geometry

482 views
Skip to first unread message

Penny Banham

unread,
Oct 29, 2015, 5:25:27 PM10/29/15
to GIS In Ecology Forum
Hi All, 

I'm trying to do my dissertation but am having some problems! I have collected GPS data for rhino locations and have plotted each location on my map. I want to create a convex hull for a estimate of the home range of each rhino. I selected the shapefile of one rhino I wanted to create a convex hull for. However, everytime I select the geometry type for a convex hull, I get a error message saying 'The Geometry Type File Option is invalid with ArcView or ArcEditor licence' - anyone know why this is popping up and how I can rectify it? I'm using ArcGIS 10.2

Thanks in advance! 



GIS in Ecology

unread,
Oct 29, 2015, 5:46:20 PM10/29/15
to GIS In Ecology Forum
Hi Penny,
 
This is a problem with the licence that you have for ArcGIS. The Convex Hull tool is only available with the ArcInfo/Advanced licence and not the ArcView/Basic or ArcEditor/Standard licence and it seems you don't have this licence, which is why you're getting the error message you got.
 
There's four solutions to this.
 
The first is to see if your institution has access to the ArcInfo/Advanced licence that you can use with your current version of ArcGIS. If they do, you can update this through the Licence Manager/ArcGIS Administrator module of ArcGIS.
 
If this isn't possible, you can try uninstalling your current version of ArcGIS (10.2), and then download (from here: http://www.esri.com/software/arcgis/arcgis-for-desktop/free-trial) and install a trial version of the latest ArcGIS edition (currently 10.3). This will give you access to the Advanced licence (and so the Convex Hull tool) for 60 days, which will hopefully be long enough for you to complete your project. 
 
A third option is to get a Home Licence for ArcGIS. This will give you access to the Advanced licence and all its tools for 12 months, but will cost you about £80/US$100, and you'll only be able to use it for non-commercial purposes (which should be fine for your research project).
 
Finally, you could try using one of the free GIS software packages. Of these, I'd recommend QGIS, and while I haven't used it, I'm pretty sure it will have a convex hull tool. It's quite easy to use, especially it you're already familiar with GIS through ArcGIS.
 
If you do decide to go down the QGIS route, post a reply on this thread and I can provide some more specific instructions for you on how to generate a convex hull with that software package.
 
I hope this helps, and good luck with your dissertation. If you encounter any further GIS-related problems, feel free to post again.
 
All the best,
 
Colin

Penny Banham

unread,
Oct 30, 2015, 8:48:21 AM10/30/15
to GIS In Ecology Forum
Hi Colin, 

Thanks so much for getting back to me so quickly. After I sent my original message I tried and downloaded the geospatial modelling environment package and I already had R and knew how to use it. I was able to create a convex hull polygon using this programme. Is this the same as doing it in Arc? Will it give me just as good results? Unfortunately, I don't think my university has the advanced licence, but I will double check, so I am hoping the GME software is capable of doing what I need it to do! 

Penny 

GIS in Ecology

unread,
Oct 30, 2015, 8:59:28 AM10/30/15
to GIS In Ecology Forum
Hi Penny,
 
I'm glad that you got this sorted. Yes, using GME is another solution, and if it works for you with your ArcGIS licence then that's great (I wasn't too sure if it would, which is why I didn't suggest it). With the convex hull polygon tools, you should get pretty much exactly the same polygon no matter what software you use to do it. The only thing to remember here is that you might get slightly different polygons if your data are in a different projection/coordinate system when you use them in different tools. This means that you need to make sure that your data points are in the projection/coordinate system you want to use for measuring things like the area of your convex hull before you create it. This can be a bit tricky to do in R and GME, but if you prepare your data in ArcGIS first, this isn't really much of a problem.
 
However, while the different software packages will give the same minimum bounding geometry as a measure of home range, if you're using other home range measurements, such as kernel density estimates (KDEs), there are a lot more possible parameters you need to set, and you can get quite different outputs depending on the software you use, especially if you only use the default settings rather than setting them manuals, so if you go down this route, watch out for this.
 
All the best,
 
Colin

Jeffrey Evans

unread,
Nov 4, 2015, 8:11:28 AM11/4/15
to GIS In Ecology Forum
Hi Penny,
I would recommend using R for you analysis. This will provide you much more flexibility and control over the geometry of the resulting hull. I included a function, with example usage, that will take an sp point object and produce a convex hull following the methods detailed in Pateiro-López & Rodríguez-Casal (2009).   

References
Pateiro-López, B., & A. Rodríguez-Casal (2009) Generalizing the Convex Hull of a Sample: The R Package alphahull. Journal of Statistical Software 34(5):1-28

Best,
Jeff

Jeffrey S. Evans, PhD., | Senior Landscape Ecologist 

The Nature Conservancy | Conservation Lands Global Science Team

Affiliate Assistant Professor | Zoology & Physiology | University of Wyoming

Laramie, WY | jeffre...@tnc.org | (970) 672-6766



Example usage on the sp meuse point dataset. You will need to install the sp and alphahull packages and, if reading in a shapefile, the rgdal package. To add the function just copy and paste into R or paste into a text editor, save and the add the function using source(). I will include this model in a future release of the spatialEco package which will provide a citation and make it a bit easier to call.

# Add required libraries and meuse data

library(alphahull) library(sp) data(meuse) coordinates(meuse) = ~x+y
# Calculate a convex hull and plot
a <- convex.hull(meuse, alpha=100000) plot(a) points(meuse, pch=19) # Test multiple alpha values and plot a=c(1000, 100000) par(mfcol=c(1,2)) for (alpha in a) { ch <- ConvexHull(meuse, alpha=alpha) plot(ch) points(meuse, pch=19) }
















##################################################################

# Function: convex.hull - creates a convex hull for point geometry

# Author Jeffrey S. Evans <jeffre...@tnc.org>

# param x sp SpatialPoints class object # param alpha Convex hull alpha value (see ?ahull) # param increment Default value 360 # param rnd Default value 2

convex.hull <- function(x, alpha=250000, increment=360, rnd=2, ...) { if (!inherits(x, "SpatialPointsDataFrame") | !inherits(x, "SpatialPoints") ) stop(deparse(substitute(x)), " MUST BE A sp Points OBJECT") x.coords <- coordinates(x) ahull2sp <- function(x, increment=increment, rnd=rnd, proj4string=CRS(as.character(NA))){ if (class(x) != "ahull") stop("x needs to be an ahull class object") xdf <- as.data.frame(x$arcs) xdf <- subset(xdf,xdf$r > 0) res <- NULL if (nrow(xdf) > 0){ linesj <- list() prevx <- NULL prevy <- NULL j <- 1 for(i in 1:nrow(xdf)){ rowi <- xdf[i,] v <- c(rowi$v.x, rowi$v.y) theta <- rowi$theta r <- rowi$r cc <- c(rowi$c1, rowi$c2) ipoints <- 2 + round(increment * (rowi$theta / 2),0) angles <- anglesArc(v, theta) seqang <- seq(angles[1], angles[2], length = ipoints) x <- round(cc[1] + r * cos(seqang),rnd) y <- round(cc[2] + r * sin(seqang),rnd) if (is.null(prevx)){ prevx <- x prevy <- y } else if (x[1] == round(prevx[length(prevx)],rnd) && y[1] == round(prevy[length(prevy)],rnd)){ if (i == nrow(xdf)){ prevx <- append(prevx,x[2:ipoints]) prevy <- append(prevy,y[2:ipoints]) prevx[length(prevx)] <- prevx[1] prevy[length(prevy)] <- prevy[1] coordsj <- cbind(prevx,prevy) colnames(coordsj) <- NULL linej <- Line(coordsj) linesj[[j]] <- Lines(linej, ID = as.character(j)) } else { prevx <- append(prevx,x[2:ipoints]) prevy <- append(prevy,y[2:ipoints]) } } else { prevx[length(prevx)] <- prevx[1] prevy[length(prevy)] <- prevy[1] coordsj <- cbind(prevx,prevy) colnames(coordsj)<-NULL linej <- Line(coordsj) linesj[[j]] <- Lines(linej, ID = as.character(j)) j <- j+1 prevx <- NULL prevy <- NULL } } lspl <- SpatialLines(linesj) lns <- slot(lspl, "lines") polys <- sapply(lns, function(x) { crds <- slot(slot(x, "Lines")[[1]], "coords") identical(crds[1, ], crds[nrow(crds), ]) }) polyssl <- lspl[polys] list_of_Lines <- slot(polyssl, "lines") sppolys <- SpatialPolygons(list(Polygons(lapply(list_of_Lines, function(x) { Polygon(slot(slot(x, "Lines")[[1]], "coords")) }), ID = "1")), proj4string=proj4string) hid <- sapply(slot(sppolys, "polygons"), function(x) slot(x, "ID")) areas <- sapply(slot(sppolys, "polygons"), function(x) slot(x, "area")) df <- data.frame(hid,areas) names(df) <- c("HID","Area") rownames(df) <- df$HID res <- SpatialPolygonsDataFrame(sppolys, data=df) res <- res[which(res@data$Area > 0),] } return(res) } a <- ahull(x.coords, alpha=alpha, ...) return(ahull2sp(a, increment=increment, rnd=rnd)) }
##################################################################







GIS in Ecology

unread,
Nov 4, 2015, 8:19:09 AM11/4/15
to GIS In Ecology Forum
Hi Jeff,
 
Thanks for posting the code for making convex hulls in R. This is really useful.
 
All the best,
 
Colin

On Wednesday, November 4, 2015 at 1:11:28 PM UTC, Jeffrey Evans wrote:
 
Hi Penny,
I would recommend using R for you analysis. This will provide you much more flexibility and control over the geometry of the resulting hull. I included a function, with example usage, that will take an sp point object and produce a convex hull following the methods detailed in Pateiro-López & Rodríguez-Casal (2009).   

References
Pateiro-López, B., & A. Rodríguez-Casal (2009) Generalizing the Convex Hull of a Sample: The R Package alphahull. Journal of Statistical Software 34(5):1-28

Best,
Jeff

Jeffrey S. Evans, PhD., | Senior Landscape Ecologist 

The Nature Conservancy | Conservation Lands Global Science Team

Affiliate Assistant Professor | Zoology & Physiology | University of Wyoming

Laramie, WY | jeffre...@tnc.org | (970) 672-6766

...

Penny Banham

unread,
Nov 5, 2015, 10:07:53 AM11/5/15
to GIS In Ecology Forum
Hi Colin, 

So I did download the free trial to create my minimum convex polygon and so far, so good (see below). I want to know what the area of the polygon is. On the attribute table below is says the Shape_Area, but I am unsure as to what units (e.g. metres squared) this is in and I am struggling to find an answer for it! Any help? Thanks, Penny 

Jeffrey Evans

unread,
Nov 5, 2015, 6:06:00 PM11/5/15
to GIS In Ecology Forum
Sorry, the code formatting got a bit messed up. Attached is an ASCII file containing the function and is suitable for sourcing in R.

Best,
Jeff
convex.hull.R

Emily

unread,
Nov 5, 2015, 6:06:00 PM11/5/15
to gis-in-eco...@googlegroups.com
Hi Penny,

You can calculate the area in any units you like using the Calculate Geometry function inside the Attribute Table.

  1. add a field in the attribute table to hold the calculated data. For the most precise results, set the field type to double.
  2. Access Calculate Geometry by right-clicking the heading for the new field and choose Calculate Geometry from the menu.
  3. In the Calculate Geometry dialog box, choose what you wish to calculate from the drop-down list next to Property and select the units you want..
  4. Click OK. The field will be populated with new calculated values.
Best,
Emily

--
-- ======================================================================
You received this message because you are subscribed to the "GIS In Ecology Forum" discussion group (http://www.gisinecology.com/GIS_in_Ecology_forum.htm).
 
To control how often you get emails from this group, go to http://groups.google.com/group/gis-in-ecology-forum/subscribe (you will need to log on to get to this page).
 
To post to this group, either log onto the group's home page or send an email to
gis-in-eco...@googlegroups.com.
 
The rules for posting to this group can be found here: http://groups.google.com/group/gis-in-ecology-forum/browse_thread/thread/df31a0822742203f#.
 
To unsubscribe from this group, email:
gis-in-ecology-f...@googlegroups.com
 
All information on this forum is provided on an 'as is' basis. GIS In Ecology is not responsible for checking the accuracy or suitability of any posting or response.
======================================================================
---
You received this message because you are subscribed to the Google Groups "GIS In Ecology Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gis-in-ecology-f...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

GIS in Ecology

unread,
Nov 6, 2015, 6:49:21 AM11/6/15
to GIS In Ecology Forum
Hi Penny,
 
The only thing I'd add to Emily's advice (which was spot on, thanks Emily) is that in order to get an accurate measure of the area of your polygon, you'll need to make sure that you're using an appropriate projected coordinate system, otherwise your measurements of area are unlikely to be accurate.
 
All the best,
 
Colin

Penny Banham

unread,
Nov 19, 2015, 9:26:44 AM11/19/15
to GIS In Ecology Forum
Hi Emily and Colin, 

I followed your instructions and made a new field. However, when I right clicked the new field, there is no calculate geometry option. There is an option to calculate field, but when the tool comes up, it seems very confusing. I have tried looking for the calculate geometry option in the tools section, but I cannot find it! 

Penny 

Emily

unread,
Nov 19, 2015, 4:57:45 PM11/19/15
to gis-in-eco...@googlegroups.com
Hi Penny,

That's odd. I'm attaching a screenshot showing where the Calculate Geometry tool is located. You can also access it by clicking Ctrl + Shift + G. Here's a link to the esri help page about Calculating Geometry.

If you still don't see the tool, it may have something to with the data format. What data type are you working with (ie shapefile, feature class) and what geometry type (point, line, polygon)?

Best,
Emily

Inline image 3

Penny Banham

unread,
Nov 22, 2015, 4:01:17 PM11/22/15
to GIS In Ecology Forum
Hi Emily, 

I working with a shapefile and a polygon. I'm trying to work out the area of a minimum convex polygon generated using the Minimum Bounding Geometry tool. When I look at the attribute table it does give me an area, but the problem is it that I don't know what units it's in. I've attached a screenshot of the attribute table and then of what comes up when I right click a new column. 

Is it different in ArcGISPro? 

Penny 


 
All information on this forum is provided on an 'as is' basis. GIS In Ecology is not responsible for checking the accuracy or suitability of any posting or response.
======================================================================
---
You received this message because you are subscribed to the Google Groups "GIS In Ecology Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gis-in-ecology-forum+unsub...@googlegroups.com.
GIS.png
GIS 1.png

GIS in Ecology

unread,
Nov 22, 2015, 4:17:04 PM11/22/15
to GIS In Ecology Forum
Hi Emily,
 
Yes, it will be different in ArcGIS Pro. At the moment ArcGIS Pro isn't the preferred option for most people, and instead it's better to use ArcGIS for Desktop (the chances are that if you have ArcGIS Pro you will already have the desktop version on your computer since the only way you can get ArcGIS Pro at the moment is with it being bundled with ArcGIS Desktop). ArcGIS Pro doesn't yet have all the tools of the desktop version, such as the CALCULATE GEOMETRY tool that Emily's suggesting. You can, however, use the FIELD CALCULATOR tool to calculate field geometry by using the Python script: !shape.area@squaremeters!. This will calculate the area in square metres.
 
In terms of the units for your areas, these will have been calculated in the map units of the projection/coordinate system that you've used to make your minimum convex polygons/minimum bounding geometry. If you are using a projected coordinate system, this will be in metres )or more specifically square metres since it's an area). if it is a geographic coordinate system, it will be in decimal degrees. You should be able to find out the projection/coordinate system of your data layer (if you don't already know it) by right-clicking on the name of the data layer in the TABLE OF CONTENTS window and selecting PROPERTIES. The information about the projection/coordinate system can generally be found in the SOURCE tab (or at least it can in ArcGIS for Desktop - not too sure about ArcGIS Pro, but is should be similar).
 
You can also try converting the values that you have for area from square metres into square kilometres (you can use the tool here: http://www.metric-conversions.org/area/square-meters-to-square-kilometers.htm to do this) and then check whether it seems right given your study area and species. This will give you a good idea of whether the units really are square metres or not
 
I hope this clarifies things. If not, just post back again - we'll get to the bottom of it eventually!
 
All the best,
 
Colin

Penny Banham

unread,
Nov 24, 2015, 7:01:55 AM11/24/15
to GIS In Ecology Forum
Hi Colin, 

I am using a projected coordinated system and I assumed it was in metres, so thank you for clarifying it!. I have several ArcGIS programmes working on my computer at the moment, with varying degrees of success, but I'm finding ArcPro quite good at the moment. 

Anyway, thanks so much for the help and taking the time to explain each bit to me! 

Penny 
Reply all
Reply to author
Forward
0 new messages