Contribute Media
A thank you to everyone who makes this possible: Read More

Turning Spatial Data into Arrays: Python Coming Handy for GIS People!

Description

GIS software is used to analyze spatial data. In some cases, GIS data can be voluminous and Python can come in handy.

Such a case will be described here. I was trying to visualize superpositions between rectangular extents (a lot of rectangular extents !) and found QGIS and PostGIS too slow for the job (although I must say I'm no PostGIS guru). I then used Python to convert my extents into arrays of 0 and 1 and could add them all in a few minutes, and visualize superpositions by turning the resulting array into an asc file. Sorry if this is not quite clear, it's easier to explain with a few pictures, as often is the case with spatial data !

I then tried to substract 2 of the resulting asc files to visualize the evolution between 2 dates, and stumbled upon a problem in Python : the files were too big to be held in memory. A developer helped me solved this problem and I undestood better how memory is used in Python and how to hold in memory only one line of a file.

All in all, this is a story about GIS people venturing into Python programming !

Scripts can be found here : https://github.com/UMR-PASSAGES/metadata-extents

Details

Improve this page