The american mink — the story about the killer code

The aim of this posting is to document the more technical aspects of establishing the knowledge necessary to follow up the action plan against american mink (neogale vison) — an alien species in the Norwegian fauna. It will show how the Python programming language and relevant programming libraries (ArcPy and others) were used in an analysis aiming to predict where the mink, under given circumstances can spread and how to efficiently, where possible, kill it.

Part of it is also to show how a spatial analyst not only solves the puzzle, but also dives in and tries to get the broader context of the task. Why do we do an analysis, and what are the consequences? Having the answers might not make me a better analyst, but it gives purpose to the work.

In Norway the American Mink is an alien species

It was almost ten years ago. I worked at the Norwegian Directorate for Nature Management. American Mink was, and still is, considered an alien species in Norway. In 2011 an action plan was published by the Directorate for Nature Management. It said the following about the species:

American mink (Nevison vison), hereafter named mink, escaped into the wild soon after the first imports in the 1920s. Import of mink was motivated by plans for establishing a fur farming industry in Norway. Feral mink has since then established populations in all Norwegian counties. This alien invasive species poses a threat to endemic Norwegian biodiversity through predation and competition. Examples are predation on ground nesting birds, their eggs and young, European crayfish (Astacus astacus) and some species and populations of fish in freshwater. Damage to indigenous species from mink, as well as positive results of eradication programs has been documented in a number of European countries. (source: Handlingsplan mot amerikansk mink (Neovison vison) — DN-rapport 5–2011)

A mink (alien species in Norway) with its catch at Litløy fyr (lighthouse) in Vesterålen, Norway. Photo by Bjørn Tennøe (Wikipedia)

Working with this particular analysis project was more fun once I got some background on the species. Local knowledge to the areas also adds to the experience. In this case I was lucky enough to get an in depth description of the species and associated challenges from one of the biologists at work. My family also has a house in the coastal areas in question. So the personal motivation bit was also in place.

Our overall goal with this work was to keep the alien species away from islands with a protection status and to find weak connections to the mainland or other infected places to make its eradication a lasting one.

How can GIS help in this process?

We started out discussing the method and drew a sketch indicating the challenge:

Figure showing the concept the procedure is based on. (figure by the author)

Combining the assumptions and required outputs we outlined a method for our analysis:

  1. Islands which in part or completely have a protection status are identified and named asset islands.
  2. Asset islands are buffered with 2.000 meters. This means drawing an outer line around all the islands at 2.000 meters. The area between the line and the island(s) marks an area where the alien species can access the islands by swimming to them.
  3. Islands that fall within the range of the previous category are assumed access areas for the islands of protection. These islands are added to the group of interconnected islands. These islands are again subject to a buffering process similar to the previous one.
  4. Buffering is repeated until it no longer reaches other islands, or a connection (based on the minimum distance) with the mainland is made.
  5. The result is a set of islands having in common that there is never more than 2,000 meters between them — directly or indirectly. This means the mink can theoretically spread to all the islands in this set of islands by swimming between them.
  6. Islands not accessible per the description in section 4) and 5) are given an end buffer of 1.000 meters leaving us with a surface we can call the alien species eradication zone. Every single eradication zone will not have overlap with other eradication zones. This is where an effort for eradication will be helpful.
  7. We applied a 2.000 meter buffer to determine a risk line along the coast. These parts of the shoreline closer to an island than 2.000 meters.

The resulting visualization of the eradication zones looks like this when using an satellite background map.

Figure showing eradication zones. (map by the author)

This is the same map using the OpenStreetMap background map.

Eradication zones. Note how zons 11 and 12 are different. Zone 11 has a connection to the mainland. Zone 12 does not. (figure by the author)

Zone 11 efforts to eradicate mink will not be successful unless one keep an eye on the bridging islands near the mainland. Zone 12 represents a better chance for keeping the islands free of mink. Zone 12 does not connect with the mainland.

The zone data provided in the attribute table contains information about the number of islands within a zone, their total perimeter and area. I initially intended calculating the distance from the zone to the shoreline. This did not work out — the calculations were meaningless since we often would get distances to shore across existing islands not within the eradication zone. Some islands are also connected to the main land with bridges, making the whole concept of mainland a bit fuzzy.

Using the code available on GitHub you can look at the results from a calculation using some demo data.

Ideas and issues influencing the implementation

Along the development of both concept and code we ended up having to consider several issues:

  • The number of islands along the Norwegian coastline is huge, the sample county Nordland alone has exactly 62.026 islands. During the analysis for the full coastline we concluded that this would not to be possible with the chosen libraries. Basically we got memory issues with ArcPy.
  • The Norwegian coastline spans across 16 administrative zones (counties). The analysis is made per admin zone. It is important that the administrators consider if there are any cross boundary eradication zones to consider and if so cooperate with the neighbor in question.
  • The final buffer operation around the last islands with a 2000 meter buffer is only 50% of the full zone size. This is done to avoid the visual confusion arising from two zones of full size intersecting while still not allowing for the proliferation of the chosen species.
  • To highlight the parts of the coastline closer to the eradication zones than 2.000 meters we chose todo a separate intersect analysis between the full buffer (2.000 meters) and the coastline giving us a coastal risk line. The risk line indicates overlaps with the relevant eradication zones.
  • The processing leads to several temporary files. These are left in the processing folder so that the user can him/herself inspect them and possibly also use them for visualization purposes.
  • We tried to implement a log file so that the user can follow the processing by tailing the file. Timestamp for start and end of processing is included.
  • Small islands along the coastline might give rise to “fake” zones as such islands will “fool” the system since the rules for this calculation does not take into account the coastline vicinity of the next island. There result could then be a coast-near eradication zone.

The implementation

The code was been written as part of my daytime work at the Norwegian Directorate for Nature Management.

Procedure drafted before programming. (figure by the author)

The tools used to solve this challenge were:

  • Python
  • WingIDE for Python
  • Arcpy
  • yEd graphml editor

The code was stored on GitHub and the below link takes you to the most updated version of this code. Admittedly it is old and it has not been updated for years. Should I do this analysis again I would either use FME or code it using PostGIS.

The code has been tested with the sample data also available in the above repository. The sample data is a subset of the archipelago of Nordland County. The coastline is complex with many islands and allows for most special cases which can be encountered n an analysis like this. Place the contents on root level on your computer and you should be good for a test drive. If you are running Linux or MacOS X you will have to adjust the paths accordingly in the current version of the code.

Other methods

Other methods could be used to achieve the goals for this analysis. Here are some other potential ways:

  • Raster based analyse instead of a vector based one
  • Code optimization
  • Replace the rather ancient ArcPy library with an OpenSource alternative
  • Use of FME to control the workflow
  • Move parts of the processing to PostGIS


I prepared a piece of software which was helpful for us in our work. I am hoping that the descriptions above can be of help in similar projects in other parts of the world — possibly also for other species. The code is a tool to help you better understand how American Mink can spread in an archipelago. It might be used for the same purpose for other species in other regions.

I guess the code could be used in relation to analysis on other types of ecological islands (not necessarily isolated by water). And it could also be used positively and not necessarily towards removing a species from an area. This way the zones could be used to understand how ecological islands are part of zones where a species can roam and prosper.

To be honest I am not sure if this code ended up being the basis of mink eradication at all.


The code would not be possible without being part of a daytime job. A fair amount of hours went into this code — far more than I could possibly use in my spare time. Neither would it be possible without the helpful and insightful inputs from and discussions with Johan Danielsen. Questions and answers on has provided a lot of relevant background for this work. The postings and answers on the Society for Conservation GIS has also been a source of inspiration and background. This posting has been prepared by me, Ragnvald Larsen. It does not represent the opinions of the Directorate for Nature Management or its successor the norwegian Environment Agency.


My opinions are my own. They do not express the views or opinions of my employer.

Relevant links

Here are some interesting links related to the work:

An earlier version of this article published at on June 19, 2013. It has since been revised substantially.




Geographer working with GIS, data management and development cooperation. My opinions are my own.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Prediction, Ad-Optimization and Segmentation Engine for E-Commerce

7 Easy Python Code For Incredible Data Visualisation

Opportunities to Learn More About Linked Data at ALA Midwinter 2017

3 Important Product Management Pain Points with Data Science

14 days of Tableau!! — Week 1

Data Just Isn’t Enough

Performing Analysis of Meteorological Data

How to Transition to Data Science from Computer Science?

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ragnvald Larsen

Ragnvald Larsen

Geographer working with GIS, data management and development cooperation. My opinions are my own.

More from Medium

How to Understand Surfaces in Grasshopper, Foundations in Grasshopper

A Gambit with the Mind

Layering, dimensionality, and the composition in photography.

View from the arXiv: Jan 31- Feb 04 2022 | Dr S J Thomson