56 votes

Understanding "Join Attributes by Location" in QGIS

Join Attributes by Location concatenates the following set of methods to compare geometries: intersects if the intersection of both geometries is not empty contains if the second geometry is ...
Taras's user avatar
  • 32.8k
29 votes
Accepted

Understanding "Join Attributes by Location" in QGIS

Don't think the QGIS docs has something as detailed as what is shown in the link in your comment (here is the link for English speakers). I would assume the terminology would be pretty much similar if ...
Joseph's user avatar
  • 75.6k
25 votes
Accepted

One-to-many joins on a feature class to a table

To multiply the features do this (available to those who have ArcGIS 10.1 or above). Place the features and table into the same file geodatabase (you must convert Shapefiles/Excel/DBF files into the ...
Richard Fairhurst's user avatar
21 votes
Accepted

geopandas spatial join extremely slow

adding the argument predicate='within' in the sjoin function speeds up the point-in-polygon operation dramatically. Default value is predicate='intersects', which I guess would also lead to correct ...
Alexis Eggermont's user avatar
20 votes
Accepted

GeoPandas spatial join and count

Try: import geopandas as gpd import pandas as pd polys = gpd.read_file(r"C:\Test\Shapes.shp") points = gpd.read_file(r"C:\Test\POI.shp") dfsjoin = gpd.sjoin(polys, points) #...
BERA's user avatar
  • 71.4k
19 votes

geopandas error "minimums more than maximums"

For the benefit of anyone else searching for this error message, one thing that can cause it is attempting to do a spatial join where the point coordinates contain nulls.
seb's user avatar
  • 291
17 votes

geopandas spatial join extremely slow

What's likely going on here is that only the dataframe on the right is fed into the rtree index: https://github.com/geopandas/geopandas/blob/master/geopandas/tools/sjoin.py#L48-L55 Which for an ...
nick_g's user avatar
  • 463
16 votes
Accepted

How to ignore invalid geometries in performing spatial join in QGIS 3.0?

From Settings -> Options -> Processing tab, expand out the General setting. Look for "Invalid features filtering" and set it to "Do not filter"
ndawson's user avatar
  • 27.6k
14 votes
Accepted

Create virtual line layer based on points and connectivity list?

General query to relate your layers in a Virtual Layer: SELECT c.*, MakeLine(f.geometry, t.geometry) AS geometry FROM "connectivityList" AS c JOIN "myPoints" AS f ON ...
geozelot's user avatar
  • 29.9k
13 votes

geopandas spatial join extremely slow

The question asks how to take advantage of r-tree in geopandas spatial joins, and another responder correctly points out that you should use 'within' instead of 'intersects'. However, you can also ...
eos's user avatar
  • 295
13 votes

Joining attributes by the biggest overlapping areas in QGIS

Since QGIS 3.12 (see the Changelog for more details) the "Join Attributes by Location" algorithm from the Processing Toolbox (Ctrl+Alt+T) has a switch to do exactly this: The type of the ...
ndawson's user avatar
  • 27.6k
12 votes

Creating spatial join between points and polygons in GeoPandas?

There is not any bug in 'sjoin' method. To realize this, you also need Rtree python module (in my case installed with easy_install) and libspatialindex library (from my Debian Linux repository). ...
xunilk's user avatar
  • 29.9k
12 votes
Accepted

One-to-many spatial join with results in one row in QGIS

There is a possibility of using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Let's assume there are two polygon layers: 'Layer_A' (brown) and 'Layer_B' (...
Taras's user avatar
  • 32.8k
11 votes
Accepted

Join / merge lines that touch and intersect in QGIS

In QGIS Plugins you'll find a 'merge lines' plugin, which at first sight seems to accomplish what you are after. cited from description: MergeLines Simplifies the topology of a line network by ...
Jochen Schwarze's user avatar
11 votes
Accepted

Getting concatenated attribute values from Spatial Join

One solution is to create a Virtual Layer and write some SQL. Type the following query into the Query section of the dialog: SELECT c.geometry, c.CITY_NAME, group_concat(z.code) AS ZIP_ids FROM ...
Germán Carrillo's user avatar
11 votes
Accepted

Count number of points by name within distinct polygons

Try: SELECT polyname, count(pid) FILTER (WHERE pid='w') AS "w", count(pid) FILTER (WHERE pid='x') AS "x", count(pid) FILTER (WHERE pid='y') AS "y", count(pid) FILTER (WHERE pid='z') AS "z" ...
BERA's user avatar
  • 71.4k
10 votes
Accepted

Getting points-touching-a-line attributes back to lines layer using QGIS?

Although @radouxju answer is valid, I will explain it a little more detailed. You need to make sure that the polyline feature is split exactly above the point locations. Use Join attribute by ...
ahmadhanb's user avatar
  • 40.7k
10 votes
Accepted

Aggregating result of many to many join of points closest to line in QGIS

Giving you only one point id is sensible. Otherwise, join operation would generate hundreds/thousands of columns in the line layer for each near point. One solution would be to add all near point ids ...
Kadir Şahbaz's user avatar
10 votes

Create virtual line layer based on points and connectivity list?

You can also use an expression using geometry generator. Make an new style layer for the point layer. Choose "Geometry Generator", "LineString/MultiLineString" for "Symbol ...
Kadir Şahbaz's user avatar
10 votes

Clipping buffers to joined polygons in QGIS

You can follow these steps: Buffer tool (distance: 100 ft) Intersection tool (input layer: buffers, overlay layer: parcel) Select by Location tool (select from: intersection, predicate: contain, by ...
Kadir Şahbaz's user avatar
9 votes
Accepted

Sum line lengths for each grid cell in QGIS

Create a polygon grid using the Vector Grid tool instead of lines. Make sure to check the polygon output. Once you have a polygon grid (also known as fishnet), you can use the Sum line length tool ...
HDunn's user avatar
  • 8,616
9 votes
Accepted

Setting list of fields to field mapping of spatial join using ArcPy?

To manipulate the fields, their order, names, and other properties it is necessary to use the arcpy.FieldMappings() class. It is not very easy to get to know them and start using, so I've added extra ...
Alex Tereshenkov's user avatar
9 votes
Accepted

Spatial join if percentage of area is within

You can try below query by getting the intersected area of both geometries and the total area of Parcel geometry, then get the percentage and compare it 90%: CREATE TABLE test_join AS SELECT t.*, m.* ...
Shiko's user avatar
  • 2,883
9 votes
Accepted

Getting the percentage of how much areas intersects with another using GeoPandas

You can achieve this using overlay operations. Here's a quick example using some fake data. import geopandas as gpd from shapely.geometry import Polygon # Creating the GeoDataFrame with the grid ...
Felipe D.'s user avatar
  • 2,411
8 votes

Speeding up QGIS spatial join?

Add a spatial index to each of your shapefile layers: Layer > Properties... > General then Create spatial index. Another way is to create them for all the layers in one go: Vector > Data ...
Sorbus's user avatar
  • 885
8 votes
Accepted

Creating spatial-join which will calculate sum of values in certain field behind attribute in ArcMap?

This can be done by something that is called Merge rule - not very easy to find, I think. Use the Spatial Join geoprocessing tool and choose the Merge rule to be Sum for the needed fields (right-...
Alex Tereshenkov's user avatar
8 votes
Accepted

Joining attributes from points to lines QGIS

I have tried to set up the example above. I hope I correctly noticed that your point layer consists of points located very close to each other. Looks like the output after using the 'Create points ...
Taras's user avatar
  • 32.8k
8 votes
Accepted

Get points within maximum distance from any point in GeoPandas

Assuming you have one geoseries with Points (for example you want to compare Point 1 to Point 2, Point 1 to Point 3,... ): import geopandas as gpd from itertools import combinations from shapely....
BERA's user avatar
  • 71.4k
8 votes
Accepted

Removing one to many links when performing spatial join in GeoPandas

That's correct - the spatial join is going to give any row from the census blocks that the buildings touch. Instead if you want to guarantee that the building is attached to only a single block then ...
om_henners's user avatar
  • 15.6k
8 votes

Error while using sjoin in GeoPandas

Solution: First: sudo apt install libspatialindex-dev Then: sudo pip3 install rtree
datasciencebegginer's user avatar

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