Monthly Archives: August 2012

GPS Derived Associations


This map is an extension of last’s month post, Visualize GPS Data in Google Maps. It takes advantage of Google Chart Tools to populate a live chart showing current and mean distance between (in this case, randomly generated) bears. Mean distance between individuals can be used as an index of association (i.e. bears that spend a lot of time near each other are likely associating in some way). Question for anyone reading: how can I add a border for each bar in the chart?

Note: sometimes the chart doesn’t load on the first try. If this happens, refresh your page.

Random Movement Game!


Building off of last week’s Friday fun, this afternoon I made this quick HTML5 game. It’s basically the same as a game on Kongregate called Particles. The rules are simple: keep your mouse cursor (haven’t tried this on iPad yet) inside the playing area as long as possible without letting a circle hit it. It’s also fun just to watch the circles move around. Enjoy!

FRI AGM Tour Route – Preliminary


The Foothills Research Institute’s Annual General Meeting is approaching, and part of it will be an interpretive bus tour. Above is a draft version of the bus tour, showing some of the stops (they could very well change in the future). More to my tastes, the map uses the Google Maps API in a variety of ways, including calculating optimal directions between waypoints to produce the polyline, and animating both marker and polyline symbols. Future development will focus on loading content into infowindows.

Random HTML5 movement

Random Friday tiny project. Click here to watch 30 circles randomly move around on an HTML5 canvas. Firefox (at least mine) can handle 74 circles, but not 75. Interestingly, Chrome can handle over 300 circles without bogging down. I was shocked to see that Internet Explorer 9 over Citrix could run this page at all, but it does, in that clunky way IE seems to do anything.

Home Range Calculation Success/Failure

Use distribution (95%) as calculated using reference bandwidth.

This is an example of how I wanted to calculate Grizzly Bear home ranges.

Success: Remembered how to write R code, and figured out adehabitatHR package in two hours.

Failure: Unfortunately, using the Least Square Cross Validation smoothing parameter requires “cross-validation to be minimized,” and none of my tests satisfied this, so we’re going to use another method. The above picture was made using the “reference bandwidth” (substitute “href” for “LSCV”) – it tends to overestimate the area used by the individual in question, so we’re not using that, either.

Anyway, here’s the code, as much a reminder for me how to write R code as anything:

1. Install and load adehabitatHR and maptools packages.

install.packages(pkgs=c(“adehabitatHR”,”maptools”), repos=””)



2. Read a shapefile into a SpatialDataPointsObject.

shape <- readShapePoints(“H:/GIS_Data/bear”)

3. Calculate use distribution, by bear (identified in the first column, shape[,1]), using the Least Squares Cross Validation smoothing parameter.

kud <- kernelUD(shape[,1],h=”LSCV”,grid=500)

4. Make a polygon (SpatialPolygonDataFrame) of the area of 95% probability.

hr <- getverticeshr(kud, percent=95)

5. Save the polygon to a shapefile.