Contents
How does overlap work in PostGIS and QGIS?
PostGIS allows you to calculate area on the fly with the ST_Area function, and there are two functions for overlap: ST_Intersects acts as a spatial join that relates one layer to the other by selecting all features that Intersect, while ST_Intersection selects the actual pieces of each feature’s geometry that intersect.
How to create a spatial database in PostGIS?
PostGIS to the rescue. For this approach, first you create a spatial database and activate the PostGIS extension with the command CREATE EXTENSION postgis. Then you can load the shapefiles into PostGIS using the shapefile loader that is bundled with PostGIS, or you could use the QGIS DB Manager to load them.
What happens when there is overlap between layers?
This will create unique polygons that consist of geometry occupied by a unique ZCTA and CD combination. So in instances where there is overlap between layers the polygon will be split into two (or more) pieces. See the image below, which illustrates CDs and ZCTAs before and after unioning in the Philadelphia area.
Why do you use double colons in PostGIS?
The double colons are a PostgreSQL shortcut for casting data types from one type to the other. This is necessary when using the ROUND function to produce a non-integer result (as ROUND can’t be used to round real decimal numbers produced from the AREA function to a fixed number of decimal places). This statement took me about 20 seconds to run.
Which is the best spatial join test for PostGIS?
My go-to performance test for PostGIS is the point-in-polygon spatial join: given a collection of polygons of variables sizes and a collection of points, count up how many points are within each polygon. It’s a nice way of testing indexing, point-in-polygon calculations and general overhead.
Can you turn a collection of overlapping polygons into a non-overlapping set?
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.
How long does it take to measure polygon overlap?
While these numbers aren’t huge, the polygons are very detailed and there is a fair amount of overlap: it took me approx 1.5 hours to run. To minimize processing time you could create copies of these layers, modify them by deleting attribute columns, and run the process on this modified layer.
Are there any records that QGIS did not return?
The results (see below) include several records that QGIS didn’t return, where the area and overlap is 0, either due to an infinitely small area of overlap that rounds to zero or strict interpretation of intersect (which includes areas that overlap and touch).
How to avoid intersection of new polygons in SQL?
The result of the test you can see in the attachment with all the code to test yourself and the insert command for the polygons present in my test. I have done the test on 1.5 but the problem is even in trunk. avoid intersection.sql ( 12.3 KB) – added by pinux 10 years ago .