Skip to content

Instantly share code, notes, and snippets.

View mdmadhu's full-sized avatar

Madhu Mysore mdmadhu

View GitHub Profile
library(gganimate)
library(magick)
library(scales)
library(sf)
library(tidyverse)
# Importing the India states shapefile into a simple feature, and reducing
# number of vertices for quick screen drawing
india = st_read("India/States.shp") %>%
@mdmadhu
mdmadhu / eBirdData_SpatialSubset.R
Last active March 2, 2017 04:52
Creates a subset of eBird data (.txt, after download and unzipping archive) that fall within a particular region of interest whose vertices are specified (see Arguments section below for how the vertices are to be specified)
# MD Madhusudan, mdm@ncf-india.org, Nature Conservation Foundation, 2017-03-02
# Creates a subset of eBird data (.txt, after download and unzipping archive) that fall within a particular region of interest whose vertices are specified (see Arguments section below for how the vertices are to be specified)
eBirdData_SpatialSubset <- function(eBirdDataFileFullPath, AoIVertices, ReturnSpatialObject=FALSE){
# ARGUMENTS
# eBirdDataFileFullPath: must be a full path to the filename, and placed within quotes
# AoIVertices: vertices of a POLYGON describing the area of interest in the form
# "76 12, 77 12, 77 13, 76 13, 76 12", where each comma-separated pair of
# values represents the longitude-latitude coordinates of each vertex. NOTE
@mdmadhu
mdmadhu / multiGPXtoCSV.r
Last active August 17, 2022 23:53
R Script to pull together GPS waypoints from multiple GPX files into a single CSV file
# MD Madhusudan, mdm@ncf-india.org, Nature Conservation Foundation, 2016-04-10
# Code to import waypoints from multiple GPX files in a folder,
# extract coordinates from each file into a single object, and
# export to CSV or some other format
#
# - initialisation steps
library(plotKML)
library(dplyr)
# Set working directory to folder where all the GPX Waypoint files are present