New answers tagged polygon
0
votes
Merging two polygon features (GeoJSON file) using QGIS
Multipolygon is an array of polygon coordinates. So you'll need to wrap the coordinates in another array. Try this:
{
"type": "Feature",
"properties": {
"id&...
1
vote
Selecting only one point in polygon using QGIS
You don't need to write a script, there is a built-in Random selection within subsets tool. Before start you need to join by location ID of the polygons to your point data and specify that field in ...
3
votes
Selecting only one point in polygon using QGIS
To add even more performance improvements to @MrXsquared's answer by using QgsGeometryEngine and skipping feature fetching:
point_lyr = QgsProject.instance().mapLayersByName('points')[0]
poly_lyr = ...
0
votes
Enlarging gBuffer width changes polygon shape
The gBuffer function needed a joinStyle = "MITRE" argument.
2
votes
Accepted
Splitting feature into individual features in QGIS
Use Multipart to Singlepart
Splits multipart features in the input layer into singlepart features.
From one multipolygon to 2786 single part polygons:
6
votes
Selecting only one point in polygon using QGIS
With the "Select by expression" tool you can use:
array_first(
array_agg(
$id,
group_by:=overlay_intersects('polygons', $id), -- replace 'polygons'
filter:=...
4
votes
Selecting only one point in polygon using QGIS
To add some performance improvements to @Ben W's answer by using a spatial index and a break command:
point_lyr = QgsProject.instance().mapLayersByName('points')[0]
poly_lyr = QgsProject.instance()....
8
votes
Accepted
Selecting only one point in polygon using QGIS
If you don't care which point is selected, you can use this small PyQGIS script. Paste into a blank editor in the Python Console, change the layer names in the first two lines to match your layer ...
5
votes
Selecting only one point in polygon using QGIS
One way to do it would be:
First do a "Join Attributes by location" (Vector -> Data Management Tools) with your points as the Base Layer, your polygons as the Join
Layer, "within&...
3
votes
Deleting small holes in polygons with PostGIS
Based on dr_jts response, I propose the following version of the design and name of the new spatial SQL function:
Create a spatial custom SQL function:
CREATE OR REPLACE FUNCTION ...
0
votes
ArcGIS clip raster with polygon - keep only cells that are fully within the polygon
This can be done after masking out conflicting cells at boundaries of polygons. So set sell size and snap raster to original raster and:
PolygonToLine_management("POLYGONS", "in_memory/...
0
votes
ArcGIS clip raster with polygon - keep only cells that are fully within the polygon
I think the issue here is that your polygons are captured using a different technique (e.g. manually captured) and scale so they don't align with the raster cells.
Here is a simple model that will ...
7
votes
Deleting small holes in polygons with PostGIS
Just to add a little less convoluted solution in SQL, shifting construction logic to ST_BuildArea - the LATERAL join predicate is an elegant method to expand and iterate over sets of rows returned ...
13
votes
Accepted
Deleting small holes in polygons with PostGIS
This is one of those processes which are simple in an iterative language, but trickier in set-oriented SQL. But the ST_DumpX set-returning functions in PostGIS and the array handling in Postgres make ...
3
votes
Deleting small holes in polygons with PostGIS
Based on your example, just extract the interior ring of your geom, calculate it's area and use it as condition in where clause as:
SELECT gid, ST_Collect(ST_MakePolygon(geom)) As geom
FROM (
...
1
vote
Clip Line Layer to Polygon but retain the Lines outside the polygons
If your aim is to only keep the lines that do not intersects the polygons you could use the "extract by location" tool.
Layer to select from : your line layer
Additional layer : your polygon ...
3
votes
How to get a list of lines, with a list of polygons that they intersect?
This is generally solved using an [INNER] JOIN, or if you are also interested in lines that do not intersect any grid cells in the result set, a LEFT JOIN; you then want to GROUP BY your line_ids and ...
1
vote
Unable to join data from another layer
If you want to join attribute data of one layer to other then you should use "Joins and Relates". Run the join command with "Join data from another layer based on spatial location"....
1
vote
Unable to join data from another layer
If you only need the attribute table from one layer to another, "join attributes by location" function with "intersect" geometric predicate, should work.
If each feature has it's ...
5
votes
Rotating by 90° one and more polygons in QGIS
Try the "Rotate" tool.
Rotates feature geometries by the specified angle clockwise. The
rotation occurs around each feature’s centroid, or optionally around a
unique preset point.
Also ...
1
vote
Extracting admin boundary data from OpenStreetMap
It depends how many boundaries you would like to extract from OSM. For single city shape osmnx would be easiest option.
If you need to get admin boundaries for whole country, processing OSM data dump ...
1
vote
Accepted
Split Polygon in one layer based on boundaries in second layer
In the processing toolbox search for Polygons to lines and convert Layer 2 into lines, then search again for Split with lines, use the lines that you have created to split Layer 1.
1
vote
Enabling "Snapping" in QGIS while drawing polygons?
In case anyone is wondering: you activated the snapping options when this toolbar appears.
0
votes
Buffering polygons with Oracle Spatial 11 vs. 19
By the Oracle Spatial 12c documentation the buffer function creates arcs https://docs.oracle.com/database/121/SPATL/sdo_geom-sdo_buffer.htm#SPATL1111 but you can process the resulting geometry ...
0
votes
Wrong polygons displayed in QGIS spatial query
There are 2 geometry column in your query, and the 1st one is used by default. You can remove it ("buffer 100m".geometry) or put it in 2nd, or declare the geometry column in the options ...
5
votes
Selecting points which touch "boundaries" of another polygon using QGIS
You can use "Select by expression" via QGIS's Processing Toolbox (Ctrl+Alt+T) or attribute table (F6). Run it on your points layer and use this expression:
distance(
$geometry,
...
4
votes
Selecting points which touch "boundaries" of another polygon using QGIS
Convert your polygons to lines
Select by location, the buffers intersecting the lines (or Select within distance, your title says points but question body says polygons)
0
votes
Split polygon by regard of distance to other shapefile
You can :
create centroids of your buldings
use Voronoi Polygons with those centroids
clipped the polygons with the water surface
If you also need the beach line, you can create the boundary of your ...
2
votes
Looking for GeoPandas equivalents of PostGIS "ST_DumpRings" and "ST_Dump" tools
Try either
.interiors:
Returns a Series of List representing the inner rings of each polygon
in the GeoSeries.
.exterior
Returns a GeoSeries of LinearRings representing the outer boundary of
each ...
1
vote
Accepted
Read geo-spatial data in R via Leaflet
Here's a sample sp-class points data frame in a projected coordinate system like your data is:
> ps
class : SpatialPointsDataFrame
features : 4
extent : 1, 4, 1, 4 (xmin, xmax, ...
0
votes
Invalid geometry in QGIS vs ArcGIS
It could be that those programs on your machine are set with different defaults for rounding decimals. If one rounds to the 7th decimal and one to the 8th decimal then you may have occasions where ...
0
votes
Counting stacked polygons in PostGIS
Let's assume there is a polygon layer called 'poly_test', see image below.
Extending the idea from @geozelot it is possible to count the polygons via grouping by their geometry.
With the following ...
2
votes
Accepted
Joining two polygons where they overlap the most in QGIS
Let's assume there are two polygon layers one called 'grid_test' (green) and the second called 'grid_test2' (orange), see image below.
Apply the "Join attributes by location" tool with the ...
5
votes
Finding change between two sets of polygon data in QGIS
Run Menu Processing > Toolbox > Geometry by expression with this expression with Input Layer the polygon layer representing the boundaries in 2020. In the expression at the end of line 2, ...
1
vote
Accepted
Create sf polygon from sf linestring and bounding box
I suggest using lwgeom::st_split() to split your counties object according to the coast linestring. It will return a geometry collection, so it needs to be piped to a sf::st_collection_extract("...
3
votes
Joining two polygons where they overlap the most in QGIS
Use QGIS expressions with this expression:
array_first (
overlay_intersects(
'Districts', -- Replace with the name of the layer
$id,
sort_by_intersection_size:='des'
)...
1
vote
Accepted
Using Shapely methods (explain_validity and make_valid) on shapefile
Two above method (explain_validity and make_valid) are applicable not to the shapefile itself, but to the objects (geometries of features) that it contains.
To apply the explain_validity() method:
...
1
vote
Looking for QGIS equivalent of ArcMap's "Selection by Location" tool with "Have their centroid in" option
You can use multiple steps:
Create centroids of the layer you want to select from
Extract the centroids within the selection polygon layer
Extract the polygons intersecting the extracted centroids:
0
votes
Using Shapely methods (explain_validity and make_valid) on shapefile
You need to control the validity of every geometry in the shapefile (= row in the geodataframe)
for i in data.index:
explain_validity(data.geometry[i])
0
votes
Speeding up a TIN to MultiPolygonZ conversion in PostGIS
Atm was actually right in his comment. And indeed, it's actually a nonsense to tessellate a TIN!
It was an error on my side.
Here is a detailed comparison for a same query with and without the use of ...
0
votes
Converting Shapely MultiPolygon to Polygon: Technique doesn't always work
object.convex_hull is all you need
Note: This object is can be a MultiPolygon
Top 50 recent answers are included
Related Tags
polygon × 3964qgis × 1390
arcgis-desktop × 636
r × 313
shapefile × 292
postgis × 289
raster × 288
point × 257
python × 255
line × 247
arcmap × 187
overlapping-features × 167
geometry × 165
intersection × 148
area × 133
vector × 131
clip × 128
splitting × 107
buffer × 102
arcpy × 100
qgis-3 × 96
merge × 87
distance × 86
postgresql × 85
arcgis-10.0 × 82