Hot answers tagged

7 votes

How do I create a polygon from points?

If I understood correctly your question, it looks like you're trying to recreate the minimum bounding polygon (a convex hull) for point groups that shares the same value of an attribute. If this is ...
7 votes
Accepted

QGIS count points in polygon geometry generator

Insert this code into Value box in the Layer Styling tab: aggregate( layer:='Random points', aggregate:='count', expression:=1, filter:=intersects($geometry, geometry(@parent)) ) Replace ...
  • 5,732
5 votes
Accepted

How can I measure the largest diameter of a polygon in QGIS

There is a tool called Minimum enclosing circles in the processing toolbox. This algorithm calculates the minimum enclosing circle which covers each feature in an input layer. See the 'Minimum ...
  • 54k
2 votes

Draw polygons around a set of points and create clusters in Python

This does not guarantee they dont overlap, you will have to manually adjust the parameters until they dont. import matplotlib.pyplot as plt import geopandas as gpd from sklearn.cluster import DBSCAN ...
  • 55.3k
2 votes
Accepted

Aggregate (dissolve) polygons leaving internal lines - R

As I commented, your problem might be solved by buffering -which means to extend the polygon homogeneously-, dissolve and then use a negative buffer to approximately restore it to its original size; ...
  • 3,344
2 votes
Accepted

Dividing a polygon using a centerline

In QGIS you can use the transect tool to create lines perpendicular to your median line, dissolve the transects, then split the polygon with the dissolved layer. The whole process looks something like ...
  • 2,634
2 votes

Buffer 200 degrees (without north, northeast and -west) for polygons in QGIS

With QGIS expressions, you can achieve that (change buffer distance 100 and 300 and degrees 0 and 200 to fit your use case): intersection ( buffer ($geometry, 100), wedge_buffer( ...
  • 44.9k
2 votes

Subset polygons in R

I think the easiest approach you could take would be to perform a spatial join from the points to the polygons. We can accomplish the join using sf, the data manipulation with dplyr, and the ...
  • 166
2 votes

How to filter points (LAT, LONG) on a map within a line boundary I created

Convert the line to a polygon using Menu Vector > Geometry Tools > Lines to polygons. Run select by expression on the point layer with this expression: overlay_disjoint ('polygons') - replace ...
  • 44.9k
1 vote

QGIS - selecting lines in polygons or cross polygon (chairlift and ski resort data)

Use QGIS expressions to calclulate length: either 1) of the the overlapping part (intersection) of a linestring with the polygons from a layer called resorts (red labels), or 2) just the total length ...
  • 44.9k
1 vote

Dividing a polygon using a centerline

Use Geometry Generator or Geometry by expression (see here for differences) with the expression below on the line layer. Red outlined: initial polygon; polygons outlined in blue and with blue gradient ...
  • 44.9k
1 vote

Converting geometry from bounds to Polygon using GeoPandas

Use shapely box import geopandas as gpd from shapely.geometry import box lines = gpd.read_file("lines.shp") # total bounds of the shapefile xmin,ymin,xmax,ymax = lines.total_bounds ...
  • 51.8k
1 vote

Plot polygon's attribute on R

Below is how I would geo join with {tigris} and an example of filtering with {tmap}. I'm interested to hear what others have to say about these methods: library(dplyr) library(sf) library(tmap) ...
  • 46
1 vote

Plot polygon's attribute on R

Select the polygons you want first from the augmented rooms object, then create an owin with the subset. > roomattr <- read.csv (file="rooms.csv", header=TRUE) > rooms = cbind(rooms,...
  • 53.8k
1 vote
Accepted

Convert dataframe with polygon geometry variable into SF object

There are two problems here. First, the API returns a fragment of a GeoJSON file, which would be a valid file for st_read to consume if it wasn't a fragment. One fix to this would be to use paste ...
  • 53.8k
1 vote

How to force close polygon to overlap/share the border

Using mapshaper and selecting on the option of "snap vertices", and then, in console, writing clean without further arguments, you get this st_difference(contry, cleaned_from_mapshaper) ...
  • 3,344
1 vote
Accepted

Select a single polygon in a FeatureCollection

Yes, you can use a filter to select the specific feature. In this case your filter would be: var selectedFeature = fc.filter(ee.Filter.eq('id', 503883));
1 vote

Counting in field calculator with several group_by- and filter-conditions

Use QGIS expressions with overlay_contains() with the following pattern on your polygon layer to get the number of points from layer points with attribute Kultur that has a value of 14: array_length( ...
  • 44.9k
1 vote

Selecting smaller polygons first into a QGIS Web map

The highlighting of qgis2web plans to do it with the current feature (with the above geometry). The only way is to raise the layer that contains the small circles, however if your layers are mixed, i....
1 vote
Accepted

Dividing Polygon into parts which have equal area using R

As I needed something similar, I wrote a small function for R following the steps of this question on "Splitting polygon into equal area polygons using QGIS" I hope this helps somebody, even ...
  • 26
1 vote

Original polygon is completely contained by new after simplifying

I've had to solve this problem recently in my commercial cartography library. I won't name it because we're not suppose to advertise here. The reason for needing the solution is to have a quick way to ...

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