I have many many small simples polygons representing some "field of view" from points. Lots of them overlap one or many others.


I would like to give "some kind of" "weight" attribute to each polygon based on "how many others do they see in their area".

Desired operations:

in the world of rasters:

It's a bit fuzzy said like that but I think the easiest operation would be to rasterize them and then sum up, for each pixel of the raster, how many "observers" do see them.
In other words, how many polygons have contributed to each pixel.
This would lead to a basic heatmap with a Z-value as "contributing polygons count" for each pixel.
(Precision: I do not use any DEM and viewshed analysis for that but the idea is the same over a plane, where the viewed area is defined by the polygons themselves).

Up to this point it is OK, but then, how to get back to the vector world of the initial polygons in order to attribute each polygon a "weight"? I can sum the values up. Simply.
But is there any algorithm already defined therefor and how to perform this operation?

for each rasterized polygon, it would be nice if pixels values were not just simply set to 1 (seen) or 0 (not seen) but rather to float values between ]0-1] (0 would still be used for: "not seen" and only that) with a weight applied as a function of the distance to the observer.

in the world of vectors:

An other (simpler) way to achieve this (a little differently but maybe more efficiently) is to stay in the world of vectors by simply attributing to each polygon:
1. "what is the maximum number of overlapped (stacked) polygons within the considered polygon" (it may be 10 other polygons intersecting the query polygon but with no overlap between them, thus this number would still be 1, if two of them overlap (and not the 8 other) within the query polygon area, then it would be 2, if all 10 overlaps themselves on the query polygons, it would be 10), or:
2. the cumulative number of other polygons overlaps (10 simples overlaps would give 10, even if some polygons overlap others on the query polygon) or:
3. a mix from the two previous points: the cumulative way + the stacked way, e.g. if 10 polygons overlap the query polygon and if two of them overlaps themselves within the query polygon, then it would be 10+2=12 (or 10+1=11 depending on how important stacking is)

Simple image examples to better clarify the request:

polygons overlapping - 1st case Legend: 10 simple overlaps. With method 1 the result would be 1.
With methods 2 and 3 it would be 10.

polygons overlapping - 2nd case Legend: 8 simple overlaps + 1 "level 2" overlap. With method 1 the result would be 2.
With method 2 it would be 10 and with method 3 it would be 10+1=11 (or 10+2=12, as if the deeper blue area top-left on the query polygon would count as 2 instead of 1).

Is there an existing function to retrieve this number for each of the 3 methods described here above for a given query polygon (in red in examples) and store this value as an attribute for this query polygon?

Working environment:

It is Python2.7 on a Linux based system which is the candidate for this task.
Working with a postgreSQL database.
Computational efficiency should not suffer too much, is possible.

  • Your input data, are they polygons which may or may not overlap within a single FeatureClass? Or does each polygon exist as a single feature in a single FeatureClass, i.e. you have 100 polygons and therefore 100 datasets?
    – Hornbydd
    Jun 9, 2017 at 14:09
  • All features comes from a single column in a single postgreSQL table (containing others fields as well of course). All features are single polygons. They are many tens of thousands of features. Jun 9, 2017 at 19:23

1 Answer 1


I did this in ArcMap but I'm sure you could achieve it in your desired GIS.

Assumption is that all polygons exist in a single dataset:

Initial dataset

You then run the UNION tool, the output is the layer chopped up and were polygons overlap you get "stacked" polygons:


You then:

  • Extract the centroids of the polygons
  • Add the XY coordinates
  • Concatenate coordinates into a single ID field
  • Run a summary stats tool counting points by group ID

Centroid count

Then is a simple matter of joining this data back the union dataset. If you want the alternative ways of counting then I think it's just a matter of processing the counts in various ways.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.