Category Archives: python

QDGC-files updated

qdgc_logoThe Quarter Degree Grid Cells (QDGC) data set has been updated. It is well over a year since last time. Some errors in the current release has made this necessary.

One of the things which kept me from doing the update was the rather complicated python-scripts combined with using the arcpy-library. The whole process was in it self complex. I dreaded sticking my head down into the python/arcpy/manual processing soup.

Through the last year or so I have started using FME more and more. Once you know a tool well you start thinking – what if… So I thought – what  if I instead of going one more round with python and arcpy tried solving this challenge using FME? Continue reading

Converting shapefiles to Mission Planner .poly-files

15-9-plannedMission Planner by Michael Oborne is an impressive piece of software. It is used to program the open-source APM autopilot. The autopilot is used to control planes, copters and rovers. I have used Mission Planner a lot and I can not do without.

Some years ago I started making a map for the Mindland island in the archipelago of Norway using a GPS, OpenStreetMap and Bing aerial imagery. The main driver for this project was to document old place names. With the drones becoming somewhat of a hobby last year I thought it would be nice to also establish a proper open license ortophoto for the island. Mission planner has what it takes to approach such a task in a structured manner, save for one thing. The polygon tool only imports .poly-files.

When working with maps some of us tend to stick with shapefiles or geodatabases. I have made a small script which allows for the conversion of a shapefile with a geographic coordinate system (wgs84) to as many .poly files as there are objects in the shapefile. Adding the functionality to Mission Planner has been indicated as possible, but has yet to materialise. So until then the script associated with this posting remains relevant. Continue reading

QDGC shapefiles available for national and continental scale distribution

Aqdgc_logo new set of the Quarter Degree Grid Cell shapefiles has been generated. The update is global and delivers an error fix for the country level files as well as a new product – continent level files.

The QDGC shapefiles contain center lon/lat coordinates and the QDGC string for the different squares. The files are offered down to level four. For a country around the equator level four covers around 45 square kilometers with length and height a little under seven kilometres.

Read more about the use of QDGC on this page:

The calculations/export  this time took around 60 hours computer pricessing time including generation of world fishnet with the different sizes, square area calculations, assigning QDGC strings, compression and more. Continue reading

American mink – alien species proliferation analysis

Procedure overview for the analysis

Procedure overview for the analysis

The aim of this posting is to document the more technical aspects of establishing the knowledge basis necessary to follow up the action plan against american mink (nevison vison) – an alien species in the Norwegian fauna. It will show how the Python programming language and relevant programming libraries (ArcPy and others) are used in an analysis aiming to understand where the mink can spread under given circumstances.

The motivation for this is to document the process for other relevant projects as well as to make relevant code and methodological descriptions available for other persons/institutions involved in similar projects. The work has been made possible with access to other freely available information online and as such this posting should be considered a timely way of paying back for “services provided”. Continue reading

Solving the ESRI arcpy dissolve challenge

ready_for_dissolveIn a recent project at work I did an analysis on the spread of an alien species in Norway using ESRI ArcGIS 10.1 SP1. In this particular analysis we assumed that the species could swim a certain number of meters in open sea. How would it spread and to what extent would current protected areas be invaded by this overseas stranger to our environment? The density of islands Norwegian archipelago is massive, so the possibility for the alien species to spread is rather overwhelming.

As part of the analysis I ended up doing buffers around islands in the Norwegian archipelago. After which it would be necessary to merge and dissolve the objects. This turned out to be problematic. But for some of the shapefiles I was working with ArcGIS (arcpy and python) simply failed to complete the dissolve operation.

After contacting our local ESRI representative, Geodata AS in Norway, they concluded that this was related to the following error in ArcGIS 10.1: NIM079373: Running a large number of features through the Dissolve or Buffer with dissolve option, hangs during process. I have not found any publicly information with this reference.

One could say that 7283 polygons is a tall order. One could perhaps also say that working with polygons in a task like this rather than with raster is asking for problems. Given enough time I will look into it – later – in that quiet week when nothing else is going on at work, sometime.

This blog post is about but  how I came to understand more about the limitations and possibilities with the ESRI arcpy Dissolve_management tool. It is also explains how I found a rather surprising way to make it faster.

Continue reading