How to delete area of polygons that overlap? - polygon

I am trying to take a single layer of polygon buffers and delete the areas in which these circular buffers overlap (or intersect... I am not sure about the correct terminology here). I have so far tried the Intersection tool and Symmetrical difference tool, but these requires two layer inputs, and I am just working with a single layer. How can I accomplish this? I am working in QGIS.
Here is what I am working with:
I simply want to select and delete the areas where these circles overlap. I have searched this extensively online, but cannot find a solution that works for me, since I am only working with one layer.

you can try select by location analysis, if select "Where the feature" condition "Overlap", it select just overlap features.enter image description here
And delete after.

You can perform SQL Query with Execute SQL tool [
https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectorgeneral.html#id85]
Where Additional input datasources is your circle layer, that must have unique value, in my example attribute is called fid
Query is:
select c1.fid as fid1, c2.fid as fid2, intersection(c1.geometry,c2.geometry) as geometry
from input1 as c1, input1 as c2
where c1.fid > c2.fid and st_intersects(c1.geometry,c2.geometry)
query result is intersaction between geometries:
aftert that you can do symmetrical difference to optain

There is a new QGis plugin named "Buffer Without Overlaps" that works fine!

Related

SketchUp: dow to make a hole in a complex component?

I have a big cube made up of many smaller cubes. Theoretically, all surfaces should be paralei/perpendicular, but maybe I didn't alligh something (I can be sure). Also, each layer of my big cube is shifted with respect to the previous one by half of the length of side of the smaller cube. So the odd and the even layers are aligned, but an odd layer isn't alligned to an even layer.
I'd like to make s hole trougout the cube, The hole should intersect surfaces of the smaller cubes.
I've found numerous examples of how to make a hole in one component (using the push/pull tool): 1, 2, 3. However, I haven't found any information on how to deal with such a complex component . How can I make a hole throughout my cube?
The idea of creating a hole is to make a figure in form of the hole (for example, a long cylinder or parallelogram) and use it to create the hole.
After creating the figure, compose it to group (let's name it "hole" group) and move it into place of the hole. Make this group as subgroup of the target group. Then use intersect tool: select "hole" group and call "Intersect Faces / With Context" in context menu. After that it is need to delete unneeded parts in the target group.
Step by step solution:
Create a figure of the hole form, group it and give "hole" name.
Move "hole" into the place of the required hole.
Arrange "hole" as subgroup of the target group.
Intersect "hole" group with Context (i.e. parent group that is our target).
Remove unneeded parts in the target group.
The issue is that every subgroup should be edited separately, and to remove unneeded parts it is need to arrange "hole" into this subgroup and do intersection again.
To create inner surface of the hole we can use copy of the "hole" group as matter. Make copy, paste it in place, rename to "surface", arrange it into target group (if any). Then open "surface" group for edit, select all, call "Intersect Faces / With Model" in context menu. Note that intersection will be done with visible parts of the model only. After that delete unneeded parts in "surface" and optionally explode "surface" group. Use layers and hide/unhide tool to temporary hide interfering parts of the model.

Can I force Google Maps to draw polygons with overlapping paths as a union rather than intersection?

I'm working on a custom Google Map where I need to have place marks made up of several polygons. When I was using a KML file, the polygons would union together, however I had to abandon KML due to the need to present the infowindow programmatically from other items on the page.
Now that I'm drawing polygons directly (new google.maps.Polygon) I find that sometimes the items are joined via union and somethings via intersect. This appears to be related to how much overlap there is.
My polygons are building shapes with their corresponding labels so I've wanted to keep the two as separate paths if possible (though this isn't necessary).
Is it possible I'm missing a setting that tells the engine how to join the paths? PolygonOptions shows nothing, but perhaps there's a hidden feature to do this.
If you have multiple paths in a polygon, the regions will subtract if the winding direction is opposite (the relative order of coordinates i.e clockwise or counter-clockwise).
Some examples:
http://www.geocodezip.com/v3_polygon_example_donut.html
http://www.geocodezip.com/v3_polygon_example_donutA.html
http://www.geocodezip.com/v3_polygon_example_donutB.html
http://www.geocodezip.com/v3_polygon_example_donutC.html
similar question

Fusion table layer filtering based on polygon

I've a fusion table map example with 5 layers given in this link : http://jsfiddle.net/ju2Re/
I want to filter the layers such that,
first I select a layer using dropdown : Office hierarchy > Zone > Bagalkot
Now I want to select the 220 KV stations only inside that polygon using the select box.
Please anyone help. Thank you in advance.
I don't believe you can do this natively with fusion tables (at least
not right now). The only query that can be used for "point in
polygon" analysis is:
ST_INTERSECTS(,
)
.
That takes a geometry as one argument, but the only values of are:
-
-
So if you have one point, you can use it to define a small circle and
use ST_INTERSECTS with a polygon, but that won't work for multiple
points.
With the current size of your tables you can use GViz to retrieve the
data from FusionTables and analyze it in the browser.
Proof of Concept (only works for "Geographical Heirarchy"/"District")
The code adds a "Contains" method to google.maps.Polygon, then iterates through the markers, displaying them if they are contained in the "activePolygon".
Proof of Concept should handle all the cases that have data

SQLite - Index for rectangle intersection without GIS extension

I have a quite large SQLite database to store some geo-data. I can't use the GIS extension and i'd also like everything to work with other databases as well.
My table structure is the following:
tbl(float fromLon, float fromLat, float toLon, float toLat, binary binaryData)
i store some binary-data within the database (the polygon of something) and store it's bounding-box in the form of fromLon,fromLat -> toLon,toLat.
Next i have some queries like "give me all binaryData (polygons) that are within this region (reqLlon1,reqLat1)-(reqLon2,reqLat2)".
a sample query would be:
SELECT binaryData
FROM tbl WHERE
(reqLon1 < toLon) AND
(reqLat1 < toLat) AND
(reqLon2 > fromLon) AND
(reqLat2 > fromLat)
The problem is, it seems that i can't figure the right index to speed things up.. a simple index like
idx1(fromLon,fromLat,toLon,toLat)
does not work out. I tried the same thing with MySQL (same layout, same index) and it states (explain select ..) that it only uses half of the index's length..
can someone give me a hint what the index should look like to work out? or could it be, that it's impossible?
You should consider using the R*Tree module.
An R-Tree is a special index that is designed for doing range queries.
R-Trees are most commonly used in geospatial systems where each entry
is a rectangle with minimum and maximum X and Y coordinates. Given a
query rectangle, an R-Tree is able to quickly find all entries that
are contained within the query rectangle or which overlap the query
rectangle. This idea is easily extended to three dimensions for use in
CAD systems. R-Trees also find use in time-domain range look-ups.

In PostGIS, how do I find all points within a polygon?

I am using PostgreSQL with the GIS extension to store map data, together with OpenLayers, GeoServer etc. Given a polygon, e.g. of a neighborhood, I need to find all LAT/LONG points stored in some table (e.g. traffic lights, restaurants) that are within the polygon. Alternatively given a set of polygons I would like to find the set of points within each polygon (like a GROUP BY query, rather then iterating over each polygon).
Are these functions something I need to program, or is the functionality available (as extended SQL)? Please elaborate.
Also for the simple 2D data I have do I actually need the GIS extension (GPL license is a limitation) or will PostgreSQL suffice?
Thanks!
In PostGIS you can use the bounding box operator to find candidates, which is very efficient as it uses GiST indexes. Then, if strict matches are required, use the contains operator.
Something like
SELECT
points,neighborhood_name from points_table,neighborhood
WHERE
neighborhood_poly && points /* Uses GiST index with the polygon's bounding box */
AND
ST_Contains(neighborhood_poly,points); /* Uses exact matching */
About if this is needed, depends on your requirements. For the above to work you certainly need PostGIS and GEOS installed. But, if bounding box match is enough, you can code it simply in SQL not needing PostGIS.
If exact matches are required, contains algorithms are publicly available, but to implement them efficiently requires some effort implementing it in a library which would then be called from SQL (just like GEOS).
I believe ST_Contains automatically rewrites the query to use the the GiST-indexed bounding box, as it notes:
"This function call will automatically
include a bounding box comparison that
will make use of any indexes that are
available on the geometries. To avoid
index use, use the function
_ST_Contains."
http://postgis.refractions.net/docs/ST_Contains.html
ST_Contains would solve your problem.
SELECT
polygon.gid, points.x, points.y
FROM
polygons LEFT JOIN points
ON st_contains(polygon.geom, points.geom)
WHERE
polygon.gid=your_id

Resources