Questions tagged [polygon]

On a map, a closed shape defined by a connected sequence of x,y coordinate pairs, where the first and last coordinate pair are the same and all other pairs are unique.

Filter by
Sorted by
Tagged with
109 votes
8 answers
266k views

Calculating polygon areas in shapefile using QGIS

How do I calculate areas of an area shapefile in square meters (m²) or in acres (ha)? I didn't find that functionality in the Vector Tools.
user avatar
  • 2,171
63 votes
2 answers
162k views

Reading shapefile in Python

My question is an extension of Vertical lines in a polygon shapefile. Kindly refer to that question first. What you will see is a method of generating vertical lines with respect to the bounding box, ...
user avatar
  • 1,361
57 votes
11 answers
63k views

Removing small spaces (slivers) between polygons?

I have a set of polygons representing administrative districts. The districts were digitized by hand, and there are small spaces (slivers) between polygons where the polygons should be touching. How ...
user avatar
  • 681
55 votes
5 answers
16k views

What are the benefits of hexagonal sampling polygons?

I am always on the lookout for useful methods to sample or partition study areas (usually in the form of raster datasets) into smaller units. Recently, I read an ESRI blog post about a new tool for ...
user avatar
  • 50.3k
47 votes
2 answers
63k views

Understanding difference between Polygon and Multipolygon for shapefiles in QGIS?

Creating Scratch layer gives me a choice between Polygon and Multipolygon, so I started wondering how should I make use of them. Reading a new book "Mastering QGIS" (through this answer by Joseph to ...
user avatar
  • 29.1k
47 votes
5 answers
77k views

Smoothing/generalizing polygon in QGIS

Is it possible to smooth or generalize a polygon in QGIS, perhaps by using a plugin like the Generalizer Plugin for lines? I could convert my polygons to lines, smooth them and convert them back to ...
user avatar
  • 7,695
45 votes
8 answers
64k views

How to create polygons with straight lines and right angles in QGIS?

When creating a polygon, how do I do it so that the lines are straight (90, 0 degrees, etc.) and when I create corners they can be right angles? For instance, how do I create a perfect square or ...
user avatar
  • 2,987
44 votes
5 answers
24k views

Calculating average width of polygon? [closed]

I'm interested in examining the average width of a polygon that represents the road surface. I also have the road centerline as a vector (which is sometimes not exactly in the center). In this example,...
user avatar
  • 15.9k
42 votes
5 answers
33k views

Fixing non-noded intersection problem using PostGIS

I'm using a PL/R function and PostGIS to generate voronoi polygons around a set of points. The function that I am using is defined here. When I use this function on a particular dataset I get the ...
user avatar
  • 15.9k
41 votes
11 answers
57k views

Is there a way of auto_increment for the ID column in QGIS

I'm creating a fictive map and so I need to create lots of points, lines and for sure polygons. Later on I export my data as geojson. But before that I aways have to go and give every element an ...
user avatar
  • 857
41 votes
4 answers
46k views

How to insert a GeoJSON polygon into a PostGIS table?

I need to insert a polygon from GeoJSON to my PostGIS table. This is how the SQL query looks like. INSERT INTO tablename (name, polygon) VALUES ( 'Name', ST_GeomFromGeoJSON( '{ ...
user avatar
  • 1,104
39 votes
10 answers
51k views

Generate points that lie inside polygon

I have polygon feature and want to be able to generate points inside it. I need this for one classification task. Generating random points until one is inside the polygon wouldn't work because it's ...
user avatar
  • 399
39 votes
3 answers
84k views

Enabling "Snapping" in QGIS while drawing polygons?

I tried to draw polygons in QGIS 1.7.0 and somehow I can't find or failed to find the "Snapping" option. I'm used to ArcGIS 10.0 where you have some snapping options, like placing points of polygons ...
user avatar
  • 2,126
37 votes
4 answers
12k views

Separate polygons based on intersection using PostGIS

I have a PostGIS table of polygons where some intersect with one another. This is what I'm trying to do: For a given polygon selected by id, give me all of the polygons that intersect. Basically, ...
user avatar
  • 1,684
35 votes
11 answers
92k views

Performing reverse clip in ArcMap?

Is there a way to perform a 'reverse' of the clip function in ArcMap? I am not exactly sure how to explain this so here is a diagram:
user avatar
  • 2,397
35 votes
1 answer
35k views

Getting TopologyException: Input geom 1 is invalid which is due to self-intersection in R?

The 'TopologyException: Input geom 1 is invalid' self-intersection error which arises from invalid polygon geometries has been widely discussed. However, I haven't found a convenient solution on the ...
user avatar
  • 5,063
34 votes
13 answers
100k views

Getting boundary of raster image as polygon in ArcMap

I have a rectangular raster image in ArcMap. How can I produce a polygon which is just the extent of the raster image? That is, I want to have a polygon layer with a single quadrilateral which is the ...
user avatar
  • 3,866
33 votes
2 answers
55k views

Joining polygons in R

I am wondering how to join spatial polygons using R code? I'm working with census data where certain areas change over time and I wish to join the polygons and the corresponding data and simply ...
user avatar
32 votes
2 answers
40k views

Converting point sets to polygon boundaries?

I'm trying to convert sets of points to their respective polygon boundaries. I think this is something like a Voronoi diagram or Convex Hull, but not quite. I'm sure there's a technical term for it, ...
user avatar
  • 549
28 votes
8 answers
28k views

Calculating area in km² for Polygon in WKT using Python

I have polygons in WKT that looks like this POLYGON ((24.8085317 46.8512821, 24.7986952 46.8574619, 24.8088238 46.8664741, 24.8155239 46.8576335, 24.8085317 46.8512821)) I would like to calculate the ...
user avatar
  • 441
28 votes
8 answers
80k views

Extracting coordinates of polygon vertices in ArcMap?

I've got about a dozen polygons in a feature class loaded in ArcMap 10, all in geographic WGS 1984. How do I easily obtain the coordinates associated with each vertex of each polygon in that feature ...
user avatar
  • 2,987
28 votes
2 answers
55k views

Extracting intersection areas in R

I have two polygons. One contains fields(X,Y,Z) and the other contains soil types (A,B,C,D). I want to know what area of every field contains which type of soil. I tried the following: library(rgdal)...
user avatar
28 votes
1 answer
74k views

How do I change the polygon fill color and border color for SpatialPolygons objects?

I have SpatialPolygons or SpatialPolygonsDataFrames which I'd like to plot. How do I change the color using the three plotting systems in R (base graphics, lattice graphics, and ggplot2)? Example ...
user avatar
28 votes
4 answers
24k views

How to find the maximum-area-rectangle inside a convex polygon?

In this post we are looking for algorithms / ideas on how to find the maximum-area-rectangle inside a convex polygon. In the following figure, numbers are the areas of the fitted rectangles. As shown ...
user avatar
  • 3,307
27 votes
5 answers
88k views

Merge intersecting polygons into one which are part of the same feature

I'm not a GIS professional so I hope I use the correct wording, at least I hope you understand my question. Let's say there are five polygons in the feature A. In the shapefile there are more ...
user avatar
  • 273
27 votes
4 answers
77k views

Merging/Dissolving polygons by Common Attribute Field in QGIS?

I have joined corresponding Local Enterprise Partnerships table data into a polygon shapefile containing UK Local Authorities. How do I Dissolve or Merge the the Local Authorities polygons by ...
user avatar
  • 451
26 votes
3 answers
12k views

Finding all neighbors using GeoPandas

I am wondering whether it is possible to identify all neighbors to each polygon using only Python (with e.g. GeoPandas) in the same way that can be done with Python in QGIS (Find neighbors polygon).
user avatar
26 votes
3 answers
4k views

Packing Polygons within polygon using ArcGIS Desktop?

I have a Boolean raster. In the grey areas of the raster I would like to fit a given size polygon within a contiguous extent. Basically, I have an irregular polygon, and i would like to "fit" a ...
user avatar
  • 925
25 votes
5 answers
15k views

Changing feature draw order in QGIS

Probably a very basic question here, I want to change the draw order of a shapefile in QGIS, how can this be done? As you can see in the picture below, only the "10" layer is shown, the others are ...
user avatar
25 votes
3 answers
14k views

How to speed up the plotting of polygons in R?

I want to plot the country borders of North America over a raster image depicting some variable and then overlay contours on top of the plot using R. I have been successful in doing this using base ...
user avatar
  • 806
25 votes
2 answers
7k views

Creating Thiessen (Voronoi) polygons using lines (rather than points) as the input features?

I have a set of line features inside a particular polygonal boundary. For each line, I'd like to generate a polygon inside which every possible point is closer to the given line than to any other line ...
user avatar
  • 12k
24 votes
3 answers
27k views

Order of polygon vertices in general GIS: clockwise or counterclockwise [closed]

Two days ago I asked a question about the internal storing order for the vertices of a polygon in ESRI shapefiles. That question was answered (Are polygons stored clockwise or counterclockwise in a ...
user avatar
  • 719
24 votes
6 answers
73k views

Converting shapefile to CSV including attributes and geometry

I have a shapefile with 60k+ entries, all of which are polygons with corresponding attributes (acreage totals, landowner names, tax ID #s, etc.). What I ultimately need is a CSV file with all of ...
user avatar
  • 241
24 votes
2 answers
11k views

How can I find a point inside a polygon in PostGIS?

How can I find a point that is guaranteed to be within a given polygon in PostGIS? I am aware of the ST_Centroid function. However, the centroid is not always within a polygon, see below: ...
user avatar
  • 9,321
23 votes
3 answers
17k views

Calculating percent area of intersection in WHERE clause

I have a table of polygons (census block groups) in Postgres. I want to tag each block group with the town (another polygon table) it mainly resides within. Is this possible? I'm thinking I'd need to ...
user avatar
  • 231
23 votes
6 answers
48k views

Converting line to polygon using QGIS

I have a shapefile with city areas, but unfortunately the shapefile only contains single lines. The shapefile looks like this: I want to convert those lines to an area-polygon shapefile in QGIS. I ...
user avatar
23 votes
1 answer
3k views

Clustering of multiple raster layers to create sub-regions using QGIS?

I'm attempting to create n sub-regions from a polygon based on a cluster analysis of a bunch of overlapping raster layers (physical layers, eg: depth, currents, waves). Currently, I can create a ...
user avatar
  • 231
22 votes
4 answers
22k views

Proper way to rbind SpatialPolygonsDataFrames with identical polygon IDs?

What's the proper R idiom for rbinding SPDFs together when the IDs overlap? Note that here (as is often the case) the IDs are basically meaningless so it's pretty annoying that I can't just make ...
user avatar
22 votes
3 answers
4k views

Why do valid polygons repeat the same start and end point?

In the GIS world, for most modern formats and Standards (e.g., Shapefiles, WKB/WKT, GML, KML, etc.), valid polygons need to have closed linear rings, which is a linestring of coordinates where the ...
user avatar
  • 39.9k
22 votes
2 answers
16k views

Instantiating spatial polygon without using a shapefile in R

So, the usual way we read a shapefile in R is via the maptools package, like this: sfdata <- readShapeSpatial("/path/to/my/shapefile.shp", proj4string=CRS("+proj=longlat")) However, I have a use ...
user avatar
22 votes
5 answers
20k views

Finding centrelines from polygons in QGIS

I was wondering if there is a way to create center lines from polygons in QGIS? I have a polygon layer, but ideally need the centerlines as a separate file.
user avatar
  • 2,397
22 votes
2 answers
57k views

How to create a simple polygon from coordinates in GeoPandas with Python?

How to create a simple Polygon from coordinates in GeoPandas in Python?
user avatar
  • 534
22 votes
5 answers
3k views

Buffer neighbouring polygons without overlap using QGIS

Is it possible to create a buffer around neighbouring polygons, so that the new polygons do not overlap? Preferably in QGIS but any other tool will do. So instead of the first result I would like ...
user avatar
20 votes
5 answers
3k views

Algorithm to fix topological errors in GIS software apps

Related question here. I notice that ensuring topological correctness is essential for GIS applications, this is because the input from user or polygon boolean operation can have severe topological ...
user avatar
  • 928
19 votes
6 answers
37k views

Filling holes in polygons automatically using QGIS

Is there an option in QGIS to fill holes in polygons automatically by setting parameters e.g. maximum area, distance between borderlines? I want to delete/fill holes that a very "thin"/small....
user avatar
  • 199
19 votes
2 answers
19k views

Listing all polygon vertices coordinates using GeoPandas

I'm trying to list all polygon vertices coordinates of a rectangle with four corners and a hole with four corners. I drew the vertices in this order: import geopandas as gpd #import matplotlib.pyplot ...
user avatar
  • 52.5k
19 votes
1 answer
14k views

Postgis - Converting 'geometry_dump' data type to a 'geometry' type

I am working with a dataset of property boundaries that has had ST_Union() run on it, thus all the polygons appear as a multi polygon in one row of a table. I would like to separate these out so I get ...
user avatar
19 votes
4 answers
16k views

Calculating roundness/compactness of polygon?

I am trying to find ways to quantitatively describe the shapes of various polygons. For my project, these polygons represent lakes, rivers, lagoons, and parks. So they can be almost any shape. One ...
user avatar
  • 351
19 votes
2 answers
21k views

Converting cluster of Points to Polygons using QGIS

I have an input point layer that is grouped into clusters, so I want to have each cluster of points converted into polygon. This question How to convert a set of points to a polygon based on a ...
user avatar
19 votes
2 answers
11k views

Fixing orphaned holes in R

I'm trying to perform a union on a common field after merging two adjacent shapefiles. The shapefiles end up with at least one thin sliver of space between them. When I attempt a union I get the ...
user avatar

1
2 3 4 5
81