Partner Profiles: Addition

Boundless partners are an important part of spreading the depth and breadth of our software around the world. In this ongoing series, we will be featuring some of our partners and the ways they are expanding the reach of our Spatial IT solutions.

Addition“Since becoming Boundless partners, we have been able to take advantage of next generation spatial technology. We find the public agencies and private businesses we work with to be increasingly interested in cost effective, professional open-source solutions, moving away from old and tired, closed products,” says Diogo Vitorino, principal of Addition, a Lisbon–based Boundless Partner.

Founded in 1998, Addition builds online information systems, sophisticated websites and mobile applications for large government efforts initiated by organizations such as National Registry for the Portugal Environment Agency and Portugal’s Institute for the Conservation of Nature and Forest.  The company’s services include infrastructure management, state-of-the-art web user interfaces, and informed IT consulting. In order to achieve this, Addition relies greatly on many of the components that make up OpenGeo Suite, including PostGIS, GeoServer, and OpenLayers.

Addition Baseform Monitor

Addition’s portfolio continues to rapidly develop, and the company has recently completed projects for Australia’s largest water utility, Sydney Water; the US Environmental Protection Agency; the Portuguese Environment Agency and multiple water utilities in Portugal. Addition has also created public portals for the Portugal Ministry of Education, they were also instrumental in creating the Eurocean website, which harmonizes data from marine research agencies across Europe, and they are the purveyors of Baseform, an open and collaborative platform for networked utility infrastructures.

“The ability to collaborate on and to discuss upcoming solutions directly with the main developers of open-source projects such as PostGIS or OpenLayers is invaluable,” continues Vitorino.

If you’d like your company to be considered for our international network of partners, please contact us!

QGIS Compared: GIS Analysis

Gretchen PetersonAs mentioned in my other posts on visualizationcartography and editing, QGIS is easy-to-install, integrates with OpenGeo Suite, and has reliable support offerings, making it a viable alternative to proprietary desktop GIS software such as Esri ArcGIS for Desktop. I showed that it works very well for visualizing most formats of spatial data and creating beautiful maps, but how well does it perform GIS analysis?

Many of the analytical capabilities in QGIS will pleasantly surprise the seasoned GIS analyst. The tools are easy to find and are intuitive to use. For example, inputs self-populate with any data already loaded into the project and many of the processes run faster than on heavier-weight proprietary GIS software. Still, comparing some of the differences and similarities between QGIS and other GIS software with respect to commonly performed analytical tasks is helpful. To that end, I’ll discuss hillshading, attribute calculation, generalizing, and running multiple tasks via models.


In proprietary GIS software such as Esri ArcGIS, hillshades are created from elevation data either temporarily or permanently. Temporary hillshades help preserve disk space while permanent hillshades can be reused in other GIS projects just as with any saved dataset. A sometimes overlooked benefit of the temporary hillshade method is that, because it is dynamically tied to the original elevation data, the z factor is recalculated as the map is zoomed in or out, allowing for a more realistic visual effect. QGIS has much the same options for creating hillshades as other tools except that all hillshades are saved in permanent files, so the dynamic z factor is not possible. The creation of hillshades can be a very basic process of accepting defaults or a very complex process with many factors for the user to tweak.


Software designed specifically for rich 3D visualization can ingest outputs from QGIS or other GIS software to create even more realistic hillshades. Blender is one such open source project that is not to be missed if you want to step up your hillshading a notch higher than what can be accomplished in GIS programs. (See also, Daniel Huffman’s Blender Tutorial.) However, the basic hillshading capabilites found in QGIS are directly comparable to that found in proprietary GIS.

Attribute Calculation

Working with tables in GIS is normally a bit difficult, no matter what GIS software you use. In proprietary products and in QGIS, the typical workflow is to load a dataset into the project, right-click the dataset name in the table of contents, select open table, and view the table of data in the separate window that pops up. Editing those attributes, adding columns, changing column names, and so on, has typically been quite difficult. QGIS, however, has made some improvements on this. Not only can column (field) names be changed, but there is now—as of QGIS 2.4—an easier way to calculate new field values than the field calculator. An Excel-like field bar with an expression box was created by Nathan Woodrow and is thoroughly explained in his post on the subject. Attribute calculation and manipulation is therefore directly comparable to that found in proprietary GIS, and with the new expression box, perhaps even easier.


Generalization of line and polygon geometry is considered an edit task in other software and is therefore included in the pricier editing versions of the software. There are two types of generalizing to consider: smoothing and simplifying. Smoothing decreases small curves (e.g., a river that generally follows a single arc but has many sinuous curves along the way could be smoothed such that the smaller curves are eliminated for small scale visualization). Simplifying decreases the number of vertices along a line or polygon such that the lines become more jagged but are faster to load and render. Smoothing in QGIS must be performed by installing the Generalizer plugin or by using the v.generalize plugin in the Processing menu. The Generalizer plugin works on line features while the v.generalize plugin also works on polygons.

For simplifying, QGIS’s Simplify Geometries tool is found under the Vector menu in the Geometry Tools section and is easy to use. Tests showed that it will simplify 4 million vertices by 97% in approximately 13 seconds (shown below). Generalizing in QGIS is therefore very similar to generalizing in proprietary GIS.



Analysts often string together a series of analyses together and want to test the resultant model out with different input datasets or different input parameters. This is fairly easy to do in both proprietary GIS software and with QGIS. In QGIS this capability is located in the graphical modeler, and while it does have some differences, it serves the same purpose and is flexible enough for even the most complicated models. Below is an example of a model from our Introduction to QGIS training course.


Hidden Gem: Frequency Statistics

Frequency statistics can now be calculated from polygon-raster overlays in QGIS. This capability was developed as part of our new QGIS for Analysts workshop, first presented at FOSS4G 2014. The script, called, is located on the QGIS GitHub Scripts page. The Frequency Statistics process takes a vector layer and a raster layer as inputs and outputs a new copy of the vector layer with some additional attributes that provide information on the most-common and least-common raster values within the vector layer polygons, noted as MAJ for “majority” and MIN for “minority” respectively. It also creates a table output which gives a detailed breakdown of all the different raster values for each feature.


For the common analytical workflows discussed above, we’ve shown that QGIS works quite well. For a free software product it may even be surprising that it includes many analytical procedures that are usually thought of as advanced and priced accordingly. My conclusion from conducting these tests is that the analytical capabilities in QGIS are such that, as with visualizationcartography and editing, it can absolutely be considered a viable alternative to your current GIS software.

Creating a custom build of OpenLayers 3 (Revisited)

OpenLayersSince OpenLayers 3 likely includes more than needed for any single application, we previously described how to generate custom builds with just the relevant code.

As promised back in February, things have changed for the better and it’s now easier than ever to create a custom build of OpenLayers 3 thanks to a task called build.js that uses a JSON configuration file. Documentation for the tool resides here.

Configuration file

We will now use build.js to create a custom build for the GeoServer OpenLayers 3 preview application, the same application that we used in our previous blog post. The full configuration file for our application can be found here.

The exports section of the configuration file defines which parts of the API will be exported in our custom build. By using the name of a class such as ol.Map we export the constructor. By using a syntax such as ol.Map#updateSize we are exporting the updateSize method of ol.Map. The exports section is basically the replacement for the exports file that we used in the older blog post.

We did not make any changes to the compile section. In the define section we are using the same defines as we were using before with Plovr, but its syntax is a bit different "ol.ENABLE_DOM=false" versus "ol.ENABLE_DOM": false. By the way, OpenLayers 3 does not use Plovr anymore.


To compile our custom build, first make sure you have run npm install in your OpenLayers 3 git clone directory, then use the following command:

node tasks/build.js geoserver.json ol.min.js

The first argument (geoserver.json) is our build configuration file, the second argument is the name of the output file.

That’s it!

The end result should be a much smaller file tailored specifically to the needs of this specific application.

Interested in using OpenLayers in your enterprise? Boundless provides support, training, and maintenance. Contact us to learn more.

QGIS Compared: Cartography

Gretchen PetersonAs mentioned in my other posts about visualization, analysis and editing, QGIS is easy-to-install, integrates with OpenGeo Suite, and has reliable support offerings, making it a viable alternative to proprietary desktop GIS software such as Esri ArcGIS for Desktop. I’ve written a couple of books on designing cartographic products so it is something I’m passionate about and it is definitely an important component of desktop GIS. So how does QGIS perform when it comes to cartographic design?

In making the examples for this blog post series, I was impressed by the capabilities of QGIS and found it was easy and straightforward to create maps like the Halloween map below.

Halloween in Fort Collins, 2014

Strength: Text and Image Elements

Placing text and images is as easy as finding the Add new label and Add image buttons on the left-hand side of the print composer (a). Once you add a text box or any other element, the Item properties tab on the right-hand side of the print composer gives you most of the complex options that you’d find in any layout or commercial GIS software such as alignment, display, and rotation (b). You can also align these elements by using the Align selected items button in the main button bar (c).


Strength: Advanced Techniques

Advanced labeling functionality is included in the main QGIS interface, including SQL-based labeling, font choice, and placement protocols. Exporting a layout to SVG for editing in Inkscape or other design software is easy. Another advanced technique is the creation of atlases, or map books, that replicate a layout for each part of an indexed main map. QGIS provides an atlas composer as part of the core functionality within the Print Composer, a very powerful feature.

Strength: Color Blending

An exciting feature is the addition of color blending modes, typically found only in design software, that can add special effects to the look and feel of the map by adding texture or special brightening effects, for example. The following modes are available: lighten, screen, dodge, addition, darken, multiply, burn, overlay, soft light, hard light, difference, and subtract. Color blending can be applied to a single layer in the layer properties dialog (a) or it can be applied to an entire map in the Print Composer (b).


Mixed Results: Map Elements

Adding the map to the layout is a little more difficult if you are used to commercial GIS software. You have to use the Add new map button (the wording of which I found to be confusing since it somehow implies a new map rather than the existing map in your project), which adds the map from the main QGIS project to the layout. Another potential area of confusion is the fact that once the map element is added to the project, it doesn’t dynamically update if the main map is changed. In fact, to update it there are actually two buttons in the map element’s Item properties: one to update the preview and the other to set the map extent. The former updates the map if a new map layer has been added or the symbology has changed but only the latter updates the map if it has been panned or zoomed. These, however, are minor quibbles.

Mixed Results: Sizing and Graticules

The Print Composer does have a few shortcomings that I suspect will be cleaned up in later releases. It isn’t possible to change the size of multiple images all at once. For example, enlarging the pumpkin images in the right-hand information panel of the example map has to be done for each pumpkin separately since selecting them all and changing the properties isn’t possible. Also, there is no graticule functionality in the Print Composer. Instead, the user would need to find or create a graticule line dataset to add as a layer in the map if a graphic-like grid was desired. Another minor quibble is that the size dialog for images has the wrong tab order (if you try to tab between the input boxes the tabbing skips boxes instead of sequentially moving the cursor to the next input box).

Hidden Gem: Gradient Fills

Gradient fills, also known as vignette effects, are also possible, in a new plugin called Shapeburst. You can use it to achieve subtle shading along land-water boundaries but also to do some unexpected things like banding the edges of administrative boundaries in different colors or to reverse-fade the edges of a map. This latter effect takes advantage of QGIS’s built-in inverted polygons tool, which simplifies what used to be a task that would take several steps to achieve.


The cartographic capabilities of QGIS are sufficient to produce almost all the common map layout components with an adequate amount of advanced capabilities and even some options, like the color blending modes, that aren’t typically found elsewhere. Cartography is where many people think that QGIS falls short. However, in making the examples for this blog post series, including the Halloween map, I was blown away by its capabilities. See also the QGIS Map Gallery for more map examples. Overall, my experience with QGIS has been that the visualizationcartography, and editing functions of QGIS have matured to the point where GIS professionals of all types can’t afford not to strongly consider adopting it. 

Partner Profiles: Geospatial Enabling Technologies (GET)

Boundless partners are an important part of spreading the depth and breadth of our software around the world. In this ongoing series, we will be featuring some of our partners and the ways they are expanding the reach of our Spatial IT solutions.

GETGeospatial Enabling Technologies (GET) was established in 2006 with the vision of becoming one of the leaders for Spatial IT solutions and services in Greece as well as more broadly in Europe and Africa. Specializing in the field of geoinformatics, GET provides robust solutions for both the public and private sector.

Since 2010, GET has deployed and supported OpenGeo Suite as part of their projects. From the very beginning, GET held a strong belief that Boundless was the premier provider for commercial open source spatial software. Through its partnership with Boundless and the use of OpenGeo Suite, GET has been able to implement projects for private companies as well as public authorities and government agencies in Greece including the Hellenic Regulatory Authority of Energy and the Greek Ministry of Agriculture. GET has also offered technical support, via the GET SDI Portal, to many public agencies like the Environmental Protection Agency of Athens and the Military Geographic Institute of Ecuador.

Hellenic Regulatory Authority for Energy (RAE)

“With the goal to provide advanced geospatial solutions based on open source, we consider Boundless an essential, valuable partner with whom we could design and implement projects effectively,” said Gabriel Mavrellis of GET.

This successful partnership derives from a relationship where each organization greatly benefits by sharing knowledge, expertise, opportunities, and vision. The developers and project managers at GET deploy projects based on OpenGeo Suite and share their knowledge and expertise with Boundless through the implementation and maintenance of solutions in Greece and abroad.

GET has successfully organized training seminars on OpenGeo Suite to provide Greek engineers and developers with a greater familiarity of the platform and its functions. GET is also a proud contributor to QGIS, providing training and translating a large part of the QGIS user interface into Greek.

If you’d like your company to be considered for our international network of partners, please contact us!

QGIS Compared: Visualization

Gretchen PetersonAny GIS professional who’s been paying attention to the professional chatter in recent years will be wondering about QGIS and whether or not it might meet some or all of their needs. QGIS is open source, similar to proprietary GIS software, runs on a variety of operating systems, and has been steadily improving since its debut in 2002. With easy-to-install packages, OpenGeo Suite integration, and reliable support offerings, we obviously see QGIS as a viable alternative to proprietary desktop GIS software such as Esri’s ArcGIS for Desktop.

But will it work for you? The short answer is: most likely yes for visualization of most formats of spatial data, probably for analysis of raster and vector data, probably for geographic data editing, and probably for cartography. Those are all very subjective assertions based on my personal experience using QGIS for the past seven months but I have been using proprietary GIS for over fourteen years as an analyst and cartographer and have written a couple of books on the subject.

By all means give QGIS a try: download and install it, drag-and-drop some data into it, and give it a spin. This is definitely a good time to evaluate it and consider adopting it across your organization.

Visualizing spatial data in QGIS

In this first post, I’m going to focus on visualizing spatial data in QGIS. These basic functions are straightforward and easy to do in QGIS:

  1. adding datasets

  2. moving datasets up and down in the layer hierarchy

  3. zooming around the map

  4. selecting features based on simple point-and-click

  5. selecting features based on complex selection criteria

  6. viewing attributes

  7. creating graduated color schemes


Strength: Versatile and efficient format support

In fact, QGIS is an effective means of viewing and exploring spatial data of almost any type. If you have complex data, you might be interested to hear that the newest release of QGIS boasts very fast, multi-threaded, rendering of spatial data that may even make it faster than leading competitors. When I began creating the map shown above, I accidentally added all of the Natural Earth 1:10m Cultural Vectors in triplicate to the project, causing some minor heart-palpitations as I realized it was going to try to render close to 100 vector layers all at once. However, my fears were unfounded as it took only a few seconds for them to render once they were all added. In the realm of visualization, it does most of the other tasks that a GIS professional would expect as well, including support for custom symbol sets (in SVG format). Adding GeoJSON data is simple, just drag a geojson file onto the Layers list. Here, we show a portion of James Fee’s GeoJSON repository of baseball stadiums:


Mixed results: Raster visualization

That said, raster visualization can yield unexpected results depending on what is desired. Some raster datasets have tables that associate bands with RGB values such that specific cell-types are rendered certain colors. Often, landcover datasets will have this kind of structure so that, for example, the raster is rendered with blue for water, green for grass, white for ice, and so on. Unfortunately, QGIS doesn’t yet support rendering based on associated table files for rasters. Another slight irritation is the continuing use of binary ARC/INFO GRID formats by some agencies who distribute raster data to the public. If you have one of these datasets, QGIS can open it but you must point to the w001001.adf file using the raster data import button.

Mixed results: On-the-fly reprojection

One of the most important ways to make GIS user-friendly is to support on-the-fly projection. I still remember when projecting on-the-fly became a part of the software that I used to use. It was the end of 1999, and life was so much easier when multiple datasets from multiple agencies in multiple projections could all be jammed together into a single project, producing a map where all the data layers were in the correct projected space. This was because reprojecting not only added extra steps requiring you to reproject everything into a common coordinate system even if all you wanted to do was visualize the data, it also meant maintaining multiple copies of the same dataset, which contributed to folder clutter and using up of valuable disk space. QGIS supports reprojection on-the-fly but it is an option that must be set in the project properties dialog. Some glitches with projections still seem to occur from time to time. Zooming in, for example, sometimes causes the map to zoom to a different place than expected. However, this unexpected behavior is inconsistent, not a showstopper, and may be fixed soon.


Hidden gem: Context

The other important aspect of visualizing data is having enough underlying context for the data. Country boundaries, city labels, roads, oceans, and other standard map data are crucial. Proprietary GIS software generally contains basemap layers that can easily be turned on and off to support visualization in this manner. QGIS also has this capability, in the form of the OpenLayers plugin, which serves up Google, OpenStreetMap, Bing, and Yahoo basemaps at the click of a button. The OpenLayers plugin is free and installs just like any other QGIS plugin—you search for it in the Plugins menu, press “install,” and make your basemap choice in the Web menu.



While QGIS may need a small amount of improvement when it comes to raster visualization and on-the-fly projection, these aren’t hindrances to a typical visualization workflow and are only mentioned here out of respect for a fair and balanced assessment. By and large, my testing has convinced me that the robust visualization capabilities that QGIS offers provide more than enough impetus for many organizations to make the switch to QGIS. In later posts, I’ll discuss how QGIS performs with respect to analysisediting, and cartography.

Partner Profiles: Agrisoft

Boundless partners are an important part of spreading the depth and breadth of our software around the world. In this ongoing series, we will be featuring some of our partners and the ways they are expanding the reach of our Spatial IT solutions.

AgrisoftEstablished in 2002, Agrisoft is an Indonesian consulting firm specializing in integrated spatial solutions using open source software. Agrisoft offers consultancy, integration and training services, product development, and knowledge of clients’ business processes.

With a population of 250 million people and a booming business community, Indonesia has proved itself to be a growing market for Agrisoft and Boundless. While the market for spatial solutions is still young, Agrisoft encourages the use of spatial software for business by promoting its value and establishing it as a viable solution. OpenGeo Suite provides a complete set of tools for Agrisoft’s clients to build spatially-enabled applications and GeoServer, OpenLayers, and PostGIS have become the preferred solutions among Agrisoft’s clients.

SIH3: Sistem Informasi Hidrologi Hidrometeorologi & Hidrogeologi

Tools and expertise from Boundless have enabled Agrisoft to expand and improve on some of their largest projects and they count among their customers the Indonesian Geospatial Information Agency and the Republic of Indonesia Ministry of Agriculture. In a current project for the Republic of Indonesia Agency for Meteorology, Climatology and Geophysics, Agrisoft is working on the SIH3 Portal, an information system for hydrology, hydrometeorology and hydrogeology. This project makes use of applications built on OpenGeo Suite to browse and explore maps showing different information and Agrisoft is redesigning the graphical user interface using OpenLayers 3.

Agrisoft continually encourages the use of open source spatial software and looks to Boundless for industry best practices and guidance for their current and prospective customers.

If you’d like your company to be considered for our international network of partners, please contact us!

Introducing Versio: Distributed Version Control for Spatial Data

Boundless is pleased to introduce Versio, our new data management and collaboration platform built specifically for spatial data. We’ve been working on Versio for over a year, extending the power of the GeoGig approach into an online platform that will transform the way organizations collaborate on, control, and share their spatial data.

Versio homepage

Versio is now available in private beta with select customers and community members. We expect to release the full platform in early 2015, but if you would like to get an early look and help us improve the product, please request an invitation at

The Problem

Spatial data is dynamic, and anyone who works with it knows that keeping it updated is a challenge. The larger the organization, the worse this problem gets. Increasing team sizes, field-based data collection, and integrated workflows that depend on the publishing of timely, updated datasets increases the complexity of managing spatial data. Too often this challenge is met by emailing shapefiles around, resulting in a file naming nightmare, and a labor-intensive process to merge data together. Alternatively, if you have the money, an expensive versioning database can be used, but even that suffers from potential centralized outages, file locks, and complex system administration.

The Solution

To solve this problem, we looked for a new model of collaboration – one that has revolutionized software development – distributed version control systems.  Boundless first introduced the distributed versioning concept to Spatial IT with GeoGig, an open source tool that draws inspiration from Git but adapts its core concepts specifically for spatial data. As GeoGig has matured, we built Versio to broaden the audience by including a high-performance server and easy-to-use web interface.

Versio’s distributed versioning model and repository data structure enables new approaches to collaboration and data management. On the collaboration side, data owners and GIS analysts determine specifically who they collaborate with, creating private data repositories and inviting others to join, or sharing a data repository for the
crowd to update. Changes to a dataset can be stored in a different “branch” of the repository, and data owners have explicit control over what changes are merged back into the core repository.

The repository data structure preserves the entire lineage of a dataset, allowing a user to track and visualize changes over time. Rather than relying on a central database, each individual’s working copy is a complete repository of the spatial data. Each “commit” to the repository is saved as a discrete version, yet also maintains its relationship to previous versions in the repository. This allows users to visualize the lineage of features across all versions, as well as the changes between different versions. Additionally, file sizes are minimized since only the changes between versions are stored (eliminating redundant data) and it is easy to rollback to a previous version of a dataset.

With Versio, we want to support as many editing workflows as possible, both online and offline. So we’ve made the platform client-agnostic to support traditional desktop GIS software as well as web, mobile, or custom applications built on the Versio API.

Request an invitation to the Versio private beta at!

GeoGig Grows Up, Contributed to LocationTech


We’re proud to announce that GeoGig is approaching its first major release and we’re contributing the project to the LocationTech working group at the Eclipse Foundation.

For those not familiar with the project, GeoGig is an open source tool that draws inspiration from Git (hence why it was previously called GeoGit) but adapts its core concepts to handle distributed versioning of spatial data. With GeoGig, users are able to import spatial data into a repository where every change to the data is tracked. These changes can be viewed in a history, reverted to older versions, branched in to sandboxed areas, merged back in, and pushed to remote repositories.

Learn more about GeoGig and how to use it with these posts and videos:

As one of the founding members of the LocationTech initiative,  we’ve given several talks at LocationTech events and look forward to continuing to participate in the LocationTech Tour. Join us at the events in New York on December 9th and Washington DC on December 11th.

PostGIS Training: Creating Overlays

PostGIS training At Boundless, we recognize that software is only as good as the problems it can be used to solve. That’s why we don’t just develop the best open source spatial software, we also teach you how to use it with supporttraining, and workshops directly from the experts.

One question that comes up often during our PostGIS training is “how do I do an overlay?” The terminology can vary: sometimes they call the operation a “union” sometimes an “intersect”. What they mean is, “can you turn a collection of overlapping polygons into a collection of non-overlapping polygons that retain information about the overlapping polygons that formed them?”


So an overlapping set of three circles becomes a non-overlapping set of 7 polygons. screenshot_69

Calculating the overlapping parts of a pair of shapes is easy, using the ST_Intersection() function in PostGIS, but that only works for pairs, and doesn’t capture the areas that have no overlaps at all. How can we handle multiple overlaps and get out a polygon set that covers 100% of the area of the input sets? By taking the polygon geometry apart into lines, and then building new polygons back up. Let’s construct a synthetic example: first, generate a collection of random points, using a Gaussian distribution, so there’s more overlap in the middle. The crazy math in the SQL below just converts the uniform random numbers from the random() function into normally distributed numbers.

WITH rands AS (
  SELECT generate_series as id, random() AS u1, random() AS u2 FROM generate_series(1,100)
    50 * sqrt(-2 * ln(u1)) * cos(2*pi()*u2),
    50 * sqrt(-2 * ln(u1)) * sin(2*pi()*u2)),4326) AS geom
FROM rands;

The result looks like this: screenshot_70 Now, we turn the points into circles, big enough to have overlaps.

SELECT id, ST_Buffer(geom, 10) AS geom FROM pts;

Which looks like this: screenshot_71 Now it’s time to take the polygons apart. In this case we’ll take the exterior ring of the circles, using ST_ExteriorRing(). If we were dealing with complex polygons with holes, we’d have to use ST_DumpRings(). Once we have the rings, we want to make sure that everywhere rings cross the lines are broken, so that no lines cross, they only touch at their end points. We do that with the ST_Union() function.

CREATE TABLE boundaries AS
SELECT ST_Union(ST_ExteriorRing(geom)) AS geom
FROM circles;

What comes out is just lines, but with end points at every crossing. screenshot_72 Now that we have noded lines, we can collect them into a multi-linestring and feed them to ST_Polygonize() to generate polygons. The polygons come out as one big multi-polygon, so we’ll use ST_Dump() to convert it into a table with one row per polygon.

SELECT nextval('polyseq') AS id, (ST_Dump(ST_Polygonize(geom))).geom AS geom
FROM boundaries;

Now we have a set of polygons with no overlaps, only one polygon per area. screenshot_73 So, how do we figure out how many overlaps contributed to each incoming polygon? We can join the centroids of the new small polygons with the set of original circles, and calculate how many circles contain each centroid point. screenshot_74 A spatial join will allow us to calculate the number of overlaps.

UPDATE POLYS set count = p.count
  SELECT count(*) AS count, AS id  
  FROM polys p 
  JOIN circles c 
  ON ST_Contains(c.geom, ST_PointOnSurface(p.geom)) 
) AS p

That’s it! Now we have a single coverage of the area, where each polygon knows how much overlap contributed to it. Ironically, when visualized using the coverage count as a variable in the color ramp, it looks a lot like the original image, which was created with a simple transparency effect. However, the point here is that we’ve created new data, in the count attribute of the new polygon layer. screenshot_75 The same decompose-and-rebuild-and-join-centroids trick can be used to overlay all kinds of features, and to carry over attributes from the original input data, achieving the classic “GIS overlay” workflow. Happy geometry mashing!

Want to learn more? Try our Introduction to PostGIS online training course!