Biodiversity by Colombian institutions

Maps of collected biodiversity by Colombian institutions

In a previous post I got the georeferenced data set of biodiversity from SIB Colombia using IAvH code. The data set is composed of 127 tables corresponding to the GBIF grid over Colombia.

Some tables still need some additional work to fix extra spaces, inconsistent characters and different encodings. But after some work, I put together all the tables. When plotting the data set, you can see where Colombian researchers have mostly collected biodiversity.

This time I want to see the use of ggplot2 and ggmaps to discover the contribution of each institution.

code chunk

The data set (bigtable) is 70 megas aprox. Pleas let me know if you are interested on it

require(ggmap)
require(raster)
require(rgeos)
#### load data set 252.944 records
bigtable <- read.csv(file = "data/sib_bigtable.csv", header = T, encoding = "UTF-8")

# get poligon Colombia
co <- getData("GADM", country = "CO", level = 1, download = TRUE)
co$NAME_1 <- iconv(co$NAME_1, "ISO_8859-2", "UTF-8")
col_depto <- fortify(co, region = "NAME_1")  # make compatible to ggplot2

# locat=as.vector(bbox(co)) ncmap =
# get_map(location=locat,source='stamen',maptype='toner',zoom=6)
# ggmap(ncmap) not nice

mapbase <- ggplot(col_depto, aes(long, lat, group = group)) + geom_polygon(fill = "grey60") +
    coord_equal() + geom_path(color = "grey")

mapbase2 <- ggplot(col_depto, aes(long, lat, group = group)) + geom_polygon(fill = "White ") +
    coord_equal() + geom_path(color = "grey")

map1 <- mapbase2 + geom_point(aes(x = lon, y = lat, group = TRUE), data = bigtable,
    size = 1.5, alpha = 1/20) + theme(legend.position = "right") + guides(guide_legend((title = NULL)))

map2 <- mapbase + geom_point(aes(x = lon, y = lat, group = FALSE), size = 1,
    data = bigtable, alpha = I(0.25), colour = "steelblue") + stat_binhex(aes(x = lon,
    y = lat, group = FALSE), size = 0.5, binwidth = c(0.5, 0.5), alpha = 2/4,
    data = bigtable)

map3 <- mapbase + geom_point(aes(x = lon, y = lat, group = TRUE, colour = factor(institution)),
    data = bigtable, size = 2, alpha = 1/2) + theme(legend.position = "right")

map4 <- mapbase + geom_point(aes(x = lon, y = lat, group = FALSE), size = 0.5,
    data = bigtable, colour = "red") + facet_wrap(~institution, ncol = 6)

The first map. All points

A map showing all collection points. The points are transparent. So darker means more points in that location.

map1

The second map. Collected Where?

A map showing hexagonal bins with more collection points. Interesting: no hexagons means no collection in that place.

map2

The third map by institution

A map showing all the points. Colors by institution. It is hard to see the different institutions.

map3

The last map, wrapped by institution

This is slow, but worth…. meanwhile take a coffee. It shows the extend of each collection by institution.

map4

It is nice to see how the Herbario Nacional Colombiano (COL) is the most extensive collection in Colombia. Now I have to figure which collection or institution is 8200001422-01…

After some comments from @OigaMen and @Danipilze now I know that the code 8200001422-01 is part of the IAvH collection. It is their NIT. So for the next post I am going to fix that.

I had fun learning how to make and publish a blog posts from R + knitr to WordPress. Next posts will even more interesting, I am sure.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s