New answers tagged

1 vote

Selecting points which are not in polygons using GeoPandas

This can be done efficiently using geopandas.sindex.query. Because the spatial index will be used it should be fast, and it is easy to avoid having duplicate points in your result. Below is a sample ...
Pieter's user avatar
  • 1,520
1 vote

Selecting points which are not in polygons using GeoPandas

Try using a spatial join. Points which are not within df2 will have na values, which can then be queried for. points_outside_df2 = df1.sjoin(df2, how='left', predicate='within').query("...
Shawn's user avatar
  • 1,737
2 votes
Accepted

Performing a zonal statistics looping over rasters and over polygons

As also discussed in the comments, rasterstats will correctly calculate zonal statistics for overlapping polygons, so you don't need to do the looping over polygons yourself. Just call zonal_stats ...
Pieter's user avatar
  • 1,520
0 votes

Finding rectangular polygons in a multipolygon

I have a working solution which is good enough for the purposes of my analysis. It is not perfect but may help someone else. I've created a processing model in QGIS that works through the following ...
CitizenFish's user avatar
1 vote
Accepted

Finding shortest distance from one point to each polygon and the distance from that point of the polygon to any of the points in the polygon in QGIS

I've assumed you have 3 layers called BasePoint (your point A), Polygon, and PointsInPolygon. Depending on how you want the distance displayed, you can get the distance from each Polygon feature to ...
Tom Brennan's user avatar
  • 4,407
1 vote

Merging two adjacent polygons which borders are not touching each other?

As your original question was about an automated/scripted solution... you could try the dissolve_within_distance feature of geofileops. import logging import geofileops as gfo if __name__ == "...
Pieter's user avatar
  • 1,520
4 votes
Accepted

Combining multiple Polygons into one MultiPolygon in QGIS

"Collect geometries" processing algorithm is what you are looking for. Takes a vector layer and collects its geometries into new multipart geometries. One or more attributes can be ...
Kalak's user avatar
  • 3,693
7 votes
Accepted

How do I merge/dissolve two polygons within one shapefile in QGIS?

It's a little tricky given that the dissolve/union simply extracts separate shapefile. Here is how you could do that: STEP 1: In the menu item go to: VIEW>TOOLBAR, and then toggle on "Advanced ...
hillsonghimire's user avatar
0 votes
Accepted

Planet API Quick-Search returns areas way larger than what I'm requesting

The notebook does the following, as mentioned above initialization of the geometry_filter: # get images that overlap with our AOI. This means that you will receive the IDs of any full PSScene images (...
mrclac14's user avatar
0 votes

Cleaning topology errors in PostgreSQL (vector data) using QGIS?

This method uses PostGIS and can be carried out in three steps. The code below is based on a polygon table is called polygon_table with a geometry column geom and a unique integer columns called ìd. ...
Mr_Robinini's user avatar
0 votes

Get the outline of badly optimized polygons (too many vertices?)

If you are able to run standalone python scripts you could try using geofileops. Especially for dissolve it should be a lot faster. Small code snippet showing how you can use geofileops.dissolve: ...
Pieter's user avatar
  • 1,520
0 votes

How to inverse the orientation of the holes coordinates of a polygon in geopandas

You can extract the interior rings with .interiors, Polygonize them, and sample a point inside each. import geopandas as gpd from shapely.geometry import Polygon df = gpd.read_file(r"/home/bera/...
BERA's user avatar
  • 71.2k
0 votes

How to calculate total area (or number of items in another layer) of multiple overlapping geometries without double counting in Oracle Spatial?

If you have n polygons, overlapping each other (or not), you should 'disolve' (in gis parlance) the polygons into one - in Oracle spatial this is done with the sdo_geom.sdo_union function: You get one ...
GregStef's user avatar
  • 103
2 votes

Some polygons are loading incorrectly as terra SpatVect but not SpatialPolygonsDataFrames

There is an issue with your polygons. In short, they are invalid. a <- readRDS("/home/sapi/Downloads/test_polygon.rds") sp::plot(a) So far so good. But in {terra}, as you said, only ...
Grzegorz Sapijaszko's user avatar
1 vote
Accepted

Remove internal boundaries from a polygon in QGIS

If dissolve leaves you with lines inside the polygon, e.g. due to not exactly overlapping feature boundaries, try buffering by e.g. 1 m including dissolving the features, then "debuffer" by -...
Erik's user avatar
  • 16.1k
0 votes

Why is the extent of a "point" grid different from a "polygon (rectangle)" grid in QGIS?

I'm not sure it answers the question of why, but the official documentation is pretty clear that the extent of a polygon grid is larger than the extent of the corresponding point or line grid. https:/...
Tom Brennan's user avatar
  • 4,407
1 vote

KML file polygon rendering weirdly in Google Earth

You've got a projection problem - you've given two points on a line and the system is drawing that as a straight line in whatever the current projection is whereas you want a visualization of the ...
Llaves's user avatar
  • 5,951
0 votes

GEE Classification Error Multiple Geometry types

You can get the polygon within the GeometryCollection using (if there is one): var list = geometryCollection.geometries().filter(ee.Filter.hasType('item','Polygon')) var polygon = ee.Geometry.Polygon(...
Kadir Şahbaz's user avatar
4 votes
Accepted

Moving individual polygons in QGIS

Make sure the polygon layer is in Editing mode (use the Toggle Editing button on the Digitzing Toolbar, or Layer->Toggle Editing). Then select the Move Feature tool from the Advanced Digitizing ...
Tom Brennan's user avatar
  • 4,407
12 votes
Accepted

Apply pattern only into strip inside polygon border in QGIS

The best way to achieve that effect is to use a line pattern fill on an "inner buffer" instead of using hatched lines. Try this expression in Geometry generator - set geometry type to ...
she_weeds's user avatar
  • 12k
5 votes
Accepted

How to identify holes of missing geometry enclosed within a polygon in QGIS?

Try this workflow: My starting layer, some holes along the borders and inside: Dissolve Delete holes Difference the Delete holes output with the start layer to create polygons where there are ...
BERA's user avatar
  • 71.2k

Top 50 recent answers are included