I’m a geographer whose work focuses on GIS and spatial analysis . I work primarily in R and Python using open source tools. This blog serves primarily to share new tools, tips and techniques I’ve found or find interesting using open source spatial analysis approaches in R and Python.

Working with Postgres / PostGIS more now and playing with reading and writing from R and Python. Here’s snippet showing read in of PostGIS in R:

Here’s an example code snippet using ftplib in python to download StreamCat data

Using match and indexing to create a lookup in R

This code takes a lookup table and applies it to a data frame, updating only values for records that occur in the lookup table using indexing and match:

Extracting line end nodes in R

I noticed the maptools package in R had a SpatialLinesMidPoints function but couldn’t find any other out of the box functions in any packages to extract line endpoints. So I modified SpatialLinesMidPoints slightly to do the job: