Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Archive for June, 2017

ZMI — Zanzibar Mapping Initiative Level 1

Posted by smathermather on June 12, 2017

The Zanzibar Mapping Initiative is the largest civilian drone mapping project in the world — an ambitious project to map the Zanzibar Archipelago using a whole host of eBee drones.

Khadija Abdulla Ali demonstrating launch.

The project is nearing completion of mapping Unguja, the larger of the two main islands.

Yussuf Said Yussuf showing how the camera seats in an eBee drone.

Yves Barthelemy talking to the ZMI team.

overview

Unguja Island from Landsat 5, 2009

Because of the large area to be covered, ZMI required an approach to partition the data into manageable flight areas.

grid

Zone grid

And in practicality, these were flown as overlapping areas, with some areas flown at a higher resolution:

grid_actual.png

Overlapping flight areas

single_tile

Now here’s the problem: how do we put these back together with just GDAL and a Windows command prompt? I had the privilege of testing out my ideas on these data:

https://gist.github.com/smathermather/d948a252f5e417334244adc05c10790b

zmi_level1

Cookie cutter versions of the imagery.

mosaic.png

Mosaic

Posted in GDAL, Other | Tagged: , , , , | 1 Comment »

A little Gorilla Time

Posted by smathermather on June 12, 2017

I miss my mountain gorilla friends in Rwanda. Let’s write a little more code to support them. I’ll be visiting Karisoke again next week, so it seems timely to post a little more code (HT Jean Pierre Samedi Mucyo for working with me on this one).

The problem today is simple — given a time series of gorilla locations and dates, can we calculate rate of travel using PostgreSQL? Well, of course we can. We can do anything in Postgre.

We have two tricks here:

  1. The first is to order our data so we can just compare one row to the next.
  2. Once we do that, we need simply to use PostGIS to calculate distance, and ordinary time functions from Postgres to calculate time difference.

This is my first use of WITH RECURSIVE, and it’s probably unnecessary (could be replaced with windowing functions), but I was very proud to finally get over my fear of WITH RECURSIVE . (We actually use one windowing function in our prep of the data. But there we are… ).

snip

For the record, WITH RECURSIVE isn’t recursive, but it is useful here in allowing us to compare the current row with the previous.

Posted in Database, Ecology, Gorillas, Karisoke, National Park, PostgreSQL, SQL | Tagged: , , , , | Leave a Comment »