An R function for finding coordinates of NZ localities

[This article was first published on The Praise of Insects, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Over the course of my PhD, I will be doing a fair amount of georeferencing. This involves obtaining geographic coordinates for localities where weevil specimens have been collected. When I’m the one who has collected them, this is fairly straightforward—Google Maps has made obtaining coordinates a breeze. When it’s a museum specimen, however, things get a little tricky. Maps and atlases are extremely useful, but hard to search through. The university has access to MapToaster which contains the topographic maps of New Zealand, and which allows one to search for place names. However, it’s only available from university computers, and the search feature requires a degree of mouse work to drive it. LINZ has made the New Zealand Geographic Place Names Database freely available online, which is also fairly fiddly to use in a high throughput situation. However, it is based on a fairly well-structured database, which allowed me to write an R function to search and retrieve information (including coordinates) for place names of interest.

The result is gazNZ(). This function allows a name to be searched for from the R console, making the process of finding coordinates a lot quicker, and means that I only need to use my keyboard when searching for things—a much more satisfying state of affairs.

> gazNZ(“Cook Strait”)
Read 201 items
Read 211 items
$`Cook Strait`
[1] -41.2493 174.4736

To leave a comment for the author, please follow the link and comment on their blog: The Praise of Insects. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)