Extracting locality data from IUCN red list shapefiles - mtop/speciesgeocoder GitHub Wiki

Introduction

This is a user requested tutorial for how to extract locality data from shape files such as the once available from the The IUCN Red List of Threatened Species website.

These files does not contain the "raw" locality data (field observations with latitude and longitude data attached) but instead polygons that gives the estimated distribution of a particular species. Assuming that the polygon correctly represents the species distribution, then the vertices/corners/"bends" (consisting of latitude and longitude coordinates) of the polygon can be used as locality data for SpeciesGeoCoder. This approach probably works best if the distribution areas are small relative to the areas you want to code the species in.

The coordinates can be extracted like this:

$ iucnPolygonsToLocalities.py SHAPEFILE.shp > out.txt

(exchange "SHAPEFILE.shp" with the name of the shape file you whant to extract the data from)

The output will in the example above be stored in a file called "out.txt" that subsequently can be used as the "localities file" with SpeciesGeoCoder.

The iucnPolygonsToLocalities.py code is available here.