MapThing v1.0 Processing Library
One of the objectives of the COSMIC project is to “extend our current techniques of visualising complex spatial systems… [to] enable a wide range of stakeholders to be involved both in understanding such complexity and using it in policy analysis.” Normally, this type of task would mean identifying a set of existing tools and producing some alternative visualisations of the same data to see what works and what doesn’t; however, as seems to be common with this type of work, I soon found that there weren’t any tools to do rapid visualisation and exploration of geodata (bar City’s excellent, but not entirely relevant to what I was trying to do, giCentre Utilities).
So, without further ado: MapThing allows you to perform a range of useful mapping (in the geographical sense) functions within Processing and offers a collection of classes for reading ESRI-compliant Shape files (a.k.a. shapefiles) and CSV point data, and then displaying them as part of a sketch. My objective here was not to implement a full-fledged GIS system, but to make it as easy as possible to take a set of geographically coded files and do something with them inside Processing without needing to think about how to map the coordinate spaces or how to read a shape file and extract useful information from it.
There are four main classes with which you want to concern yourself:
- BoundingBox is how you define the geographic envelope within which the sketch is displayed, in effect it maps the geographic space on to the viewable space of the sketch itself;
- Lines is used to read and display line-type shapefiles;
- Points is used to read and display point-type shapefiles; and
- Polygons is used to read and display polygon-type shapefiles.
You can also read in point data (tested) and line data (not tested) from CSV files and project this using the same mechanism.
The PDE sample file offers a working example of most of what is discussed above.
The library is available for download here: http://www.reades.com/MapThing.zip
Detailed feedback or suggestions are welcome.
jon