8

Tested on QGIS 2.18 and QGIS 3.4 I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Let's assume we have three features in "vegetation" and four in "treatment" accordingly, see image below. With the following Query, it is possible to achieve the result SELECT vegetation.*, (CASE WHEN vegetation.id IN ...


8

This solution might be not the best one in terms of time consumption and performance because of the data size (calculating for the whole world). However, if you want to achieve a "rapid" result (here you do not need to set up anything) IMHO this is what you need. Nevertheless, handling large data sets will be much more efficient by means of PostgreSQL with ...


6

I would look into using ST_ClusterDBSCAN. I have had tremendous success using this function to solve many cluster like geometric problems. WITH clusters AS(select st_clusterdbscan(shape,0,2) over() cluster_id,shape from table ) select st_union(shape) shape from clusters where cluster_id is not null group by cluster_id union select shape from clusters ...


6

Duplicate each layer (Right click on the layer name > duplicate layer). This does not create any additional data. It simply loads the same source data into the project again. Change the style of the original layers to the red line only. Move both duplicate layers underneath the original layers in the layer panel. Set the style of the duplicate layers to ...


6

The intersects function requires two geometries (not layers) as input requirements as described in the help section of the field calculator: intersects(geometry a, geometry b) Tests whether a geometry intersects another. Returns true if the geometries spatially intersect (share any portion of space) and false if they do not. If you want to use layer ...


5

Inside a model this requires a ; separated list field1;field2;field3


5

Non-intersections are tricky. To avoid a cartesian product of the joined tables you need to either check against a collection/union of the joined tables' geometries: WITH col AS ( SELECT ST_Collect(geom) AS geom FROM egmap_20170316_tmc_polyline ) SELECT * FROM qlayer4 AS a JOIN col AS b ON NOT ST_Intersects(a.geom, b.geom) ; which ...


5

You can do this using Aggregate function. Add a new field isTreated in the vegetation layer with an expression like below if(aggregate( layer:= 'treatment', aggregate:='count', expression:=fid, filter:=intersects($geometry, geometry(@parent)) ) > 0, 1, 0) The aggregate function returns number of features from the treatment layer that are ...


5

In order to merge multiple features into one used the Merge Selected Features function. Choose all the item you want to merge, they don't need to touch each other. Make sure that the Advanced Digitizing Toolbar is on, and click on the Merge Selected Features function. Know you need to choose how to merge your features. In a table with few rows it's ...


5

Try Intersecting highways and trails with output_type Point: Point intersections will be returned. If the inputs are line or polygon, the output will be a multipoint feature class.


5

Queries shall do the work but they can probably be optimised, e.g. proceeding with a loop. Currently working on those improvements Tested on QGIS 2.18 and QGIS 3.4 I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Option 1. For features in different layers Let's assume we have the following layers "...


5

OSM usually doesn't contain the exact outline of a junction or intersection (except in very few cases where area:highway has been mapped) and most roads don't have a width set. However you can try to estimate it by looking at the highway class (i.e. primary, secondary, tertiary...) and the number of lanes.


4

In database/DB manager/Virtual Layers/Qgis layers you can try the following query : select count(*), line_id, grid_id from line_layer, grid_layer where st_intersects(line.geometry, grid_geometry) and line.width='large' group by grid_id You'll have to adapt the attributes according to your data structure.


4

The polygon is not defined properly, making it an empty geometry. You need to add an extra square bracket. The doc says that polygons are defined by an array of linear rings, to allow having holes. While at it, let's make a valid polygon by having the same first and last coordinate. select st_astext(ST_GeomFromGeoJSON('{"type": "Polygon", "coordinates": [[...


4

The trigger is throwing an error because the endpoints of the snapped lines do not intersect the building. A point-to-line snap operation returns the closest point to the line that can be represented as a double-precision floating point. Since the exact intersection point is often not representable, the endpoint of the snapped line will not intersect the ...


3

Since you have access to the center-line I'd suggest to go a different way; find all address points whose projected point on the center-line falls between the (min/max) fraction of line-length of those of the obstacles vertices. Note: I will only consider a single obstacle case and assume that I can find a single road center-line by simply intersecting both....


3

When dealing with a large amount of spatial data, it is advisable to tunr Postgresql for PostGIS. This can make a dramatic difference to performance and may be a contributing factor in your case. Another performance enhancer that works alonside indexes is clustering. Eseentially, clustering moves features that are spatially near each other to be ...


3

In theory GROUP BY ST_Centroid(geom) should work. But the number of decimal places for the centroid you're grouping by is not quite the same. You can see it by using ST_AsText(geom). I tried using ST_SnapToGrid(geom, 0.0001) for your sample data, but it also doesn't get all the POINT's in the same precision (to be honest, for me, it seems like a bug, because ...


3

Try using ST_PointN and generate_series. You could look through tutorial here from @Paul Ramsey Breaking a Linestring into Segments CREATE TABLE lines ( gid integer primary key, geom geometry(Linestring, 4326) ); INSERT INTO lines VALUES (1, 'SRID=4326;LINESTRING(1 1, 2 2, 3 3, 4 4)'); INSERT INTO lines VALUES (2, 'SRID=4326;LINESTRING(0 1, 0 2, 0 3,...


3

EDIT: I deleted my previous answer as it was wrong. First big mistake I made was performing dot and cross products using spherical coordinates. One needs to convert them to Cartesian first. (I didn't figure out how to type in math, so I'm pasting images showing all the math). Below is the python implementation: def spherical2Cart(lat,lon): clat=(90-...


3

In the processing toolbox, there is a tool named Polygon self-intersection that can be used to extract the intersection polygon in the same layer: Input file: Using the tool: After running the tool: Then you can calculate the area. I am using QGIS 3.4.2


3

The query used to find the intersection adds the clause WHERE a.id < b.id to ensure that an intersection between two polygons is reported once only (A intersects B, and ignores B intersects A). It is invalid to consider an intersections as being related to a single polygon... they must include two polygons. It is important to note that since ...


3

A possible performance improvement for large amounts of features, and a slight improvement in readability: SELECT DISTINCT a.*, CASE WHEN b.id THEN 1 ELSE 0 END AS "isTreated" -- but, better to avoid camelCase as column names FROM vegetation AS a LEFT JOIN treatment AS b ON ST_Intersects(...


3

Not sure but I think you are running out of lines after the first comparision of polygon1-line1, second comparison will be polygon2-nothing. If you for each polygon compare all lines (in your case one) you will get the results you want: poly.geometry.map(lambda x: x.intersects(line.geometry.any())) 0 True 1 True 2 True 3 False 4 False 5 ...


3

I would go with a QGIS/LibreOffice combo (HT Kazuhito): In QGIS Use the intersection tool to create a new layer, with repeated features. Each time a (point) feature of the Input layer is contained in a (polygon) feature of the Overlay layer, a new (point) feature is created in the Output layer. (Point) features not contained in any (polygon) feature ...


3

You can do this with the join attributes by location (summary) tool. If your polygons are in multiple layers, merge them into a single layer before proceeding. Use the merge vector layers tool or select, copy and paste the polygons into a single layer. I'm assuming that your polygon layer has an attribute table field (eg, "name") which contains the polygon ...


3

Look at the How to find the intersection areas of overlapping buffer zones in single shapefile? and the solution is to 1) use the properties of unary_union with the LinearRings/LineString of the polygons (it cuts the lines at each intersection,Planar graph) listpoly = [a.intersection(b) for a, b in combinations(shapely_arr_polygon, 2)] print(len(listpoly) ...


3

It may be that the intersect tool is splitting the lines as expected. The issue is coming from the type of feature being produced. It looks like the output is a multipart polyline. Which could best be explained as a line having multipart parts (sections) but the geometry of the line is held within one feature or FID. There is a tool in ArcMap called the "...


3

You have two options I can think of off hand. 1 You could use the select by location tool, and select all polygons that intersect the points. Then reverse the selection in the attribute table, thereby switching the selection from those that have points within them, to those that do not interact with the points at all. 2 You could run the spatial join ...


3

To my knowledge this requires multiple steps. Note: This will give wrong results if you have overlapping polygons on one of your layers already. Merge vector layers and select all the layers in question. This gives you one single layer to continue with. Also it adds a layer and path attribute to each feature to keep track of their provenience. Union with ...


Only top voted, non community-wiki answers of a minimum length are eligible