Skip to main content

Questions tagged [geometry]

(1) abstract geometry; (2) storing geographic data in projected coordinates; (3) a generic ESRI term for vector features; a class for "geometry" objects.

Filter by
Sorted by
Tagged with
143 votes
14 answers
79k views

What are Definition, Algorithms and Practical Solutions for Concave Hull?

Convex Hull A convex hull of a shape is defined as: In mathematics, the convex hull or convex envelope for a set of points X in a real vector space V is the minimal convex set containing X (Wikipedia)...
Adam Matan's user avatar
  • 6,848
99 votes
4 answers
198k views

Getting coordinates from geometry in PostGIS

This line: SELECT geom FROM myLayer.geom will return a hex value. How would I get decimal values, which is a human-readable coordination?
Kourosh's user avatar
  • 1,299
97 votes
8 answers
128k views

Finding minimum-area-rectangle for given points?

As you see in the figure, the question is: How to find the minimum-area-rectangle (MAR) fitted on the given points? and a supporting question is: Is there any analytical solution for the ...
Developer's user avatar
  • 3,407
88 votes
6 answers
62k views

Visualising WKT geometry string in QGIS

Is there a simple tool in QGIS to graphically visualise geometry formatted as text? Example geometry: POLYGON((571178 6337246,571178 6402217,598061 6402217,598061 6337246,571178 6337246)) Result: A ...
Chau's user avatar
  • 4,500
60 votes
11 answers
69k 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 ...
zoo's user avatar
  • 711
50 votes
5 answers
96k 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 ...
MartinMap's user avatar
  • 8,358
47 votes
10 answers
111k views

Determining the centroid of polygons in QGIS

I have a polygon vector and I want to quickly attain the centroid of this polygon for insertion in a text document. I am working with QGIS. I searched through other questions and although some are ...
David's user avatar
  • 771
43 votes
1 answer
46k views

Finding center of geometry of object?

Given a set of 2D or 3D points: How to find the center of geometry of an object? According to the following figure, the center of geometry differs from the center of mass if it is calculated in the ...
Developer's user avatar
  • 3,407
37 votes
7 answers
46k views

Fixing geometry validity errors in QGIS 2

I am working on ownership data at a US county level. I have one shapefile per county that contains thousands of tax parcels. I need to dissolve the polygons representing parcels owned by the same ...
Bap's user avatar
  • 983
34 votes
2 answers
11k views

How is ST_PointOnSurface calculated?

The PostGIS documentation states that ST_PointOnSurface returns "a POINT guaranteed to lie on the surface". It seems like this function could be trivially implemented to give results that satisfy the ...
mjobrien's user avatar
  • 443
33 votes
1 answer
55k views

Storing GeoJSON FeatureCollection to PostgreSQL with PostGIS?

I am new to GeoJSON. I have a GeoJSON features collection as shown and would like to store it in postgres table (testtable). My postgres table has a serial id and geometry column. { "type": "...
Jay's user avatar
  • 333
32 votes
4 answers
42k views

Filter by bounding box in GeoPandas

I have a GeoPandas DataFrame in EPSG:4326 and I'd make a new DataFrame consisting of all the rows that fall within a certain bounding box. First I get the bounding box that I care about (which is ...
Richard's user avatar
  • 3,319
32 votes
3 answers
58k views

Copy a geometry from one feature to another without attributes?

With QGIS it's easy to add a new part to an existing feature/geometry but I can't see how to copy/paste this part from another existing feature/geometry. Is it possible?
nippo's user avatar
  • 515
30 votes
4 answers
101k views

Create a geography/geometry column from x and y fields - SQL Server 2008

I'm new in SQL Server 2008 and I hope you will understand my question/need. Thus, I have a table which contains 3 fields (Name, Lat and Long) in my data base (spatial). I want to create a geometry/...
Tudor's user avatar
  • 331
30 votes
4 answers
29k 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 ...
Developer's user avatar
  • 3,407
29 votes
3 answers
53k views

Converting GeoJSON to Python objects? [closed]

New to the site, and to geoJSON, and to python. My goal is to read in a file with geoJSON data, and use it to generate shapes to be used in an application that is using python scripting. Python ...
Mike Weber's user avatar
25 votes
7 answers
52k views

Filling holes in polygons 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....
J-Man's user avatar
  • 259
24 votes
3 answers
11k views

How to store lines and polygons in JSON documents?

Looking at the increasing NoSQL movement and considering that databases like MongoDB offers a new perspective in flexible data storage for GIS. What is the best way to store lines and polygons in ...
Pablo's user avatar
  • 9,845
24 votes
3 answers
21k views

Seeking Generalisation Strategies for Building Outlines in PostGIS?

I have a dataset of building footprints vectorised from a raster dataset. The dataset is currently just a vector representation of the raster data. I would like a polygon dataset that only has ...
Matthew Snape's user avatar
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: ...
fmark's user avatar
  • 9,381
23 votes
6 answers
82k 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 ...
Rikk's user avatar
  • 231
23 votes
3 answers
9k views

How to calculate the angle at which two lines intersect in PostGIS?

I want to calculate the angle between two lines where they intersect in PostGIS. The starting point for angle calculations in PostGIS seems to be ST_Azimuth - but that takes points as input. My first ...
mvexel's user avatar
  • 1,680
23 votes
1 answer
1k views

Space filling between random 2D lines

Consider a region (2D) filled with lines randomly (following Figure). We are interested in filling the empty spaces between lines including four boundary edges in a way: 0- maximizing the size of ...
Developer's user avatar
  • 3,407
21 votes
2 answers
17k views

How to draw polygons from the python console?

I've been visiting and revisiting the page on geometry handling in the PyQGIS Cookbook: http://documentation.qgis.org/2.0/en/docs/pyqgis_developer_cookbook/geometry.html but can't seem to figure out ...
user25976's user avatar
  • 2,125
20 votes
1 answer
16k 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 ...
Roman Trubka's user avatar
19 votes
5 answers
8k views

Comparing two geometries in ArcPy?

I am trying to compare two separate feature classes to identify differences between them (sort of a diff function). My basic workflow: I extract the geometries using a SearchCursor Save the ...
Michalis Avraam's user avatar
19 votes
3 answers
4k views

What is the precision of SELECT DISTINCT on PostGIS geometry column?

I wonder what the precision of the SELECT DISTINCT operator is on a PostGIS geometry. On my system, the following query gives me a count of 5, which means that the inserted points are considered equal ...
yellowcap's user avatar
  • 3,033
19 votes
2 answers
10k views

Finding tunnel center line?

I have some map files consisting of 'polylines' (each line is just a list of vertices) representing tunnels, and I want to try and find the tunnel 'center line' (shown, roughly, in red below). I've ...
sje397's user avatar
  • 291
18 votes
2 answers
5k views

Difference between QgsPoint, QgsPointXY and QgsGeometry.fromPointXY() in PyQGIS

I am using PyQGIS. What is the difference between: QgsGeometry.fromPointXY(QgsPointXY(x, y)) QgsPointXY(x, y) QgsPoint(x, y) When I print these three options, I get: print(QgsGeometry.fromPointXY(...
Sara Isabel Aleixo Perestrelo's user avatar
17 votes
3 answers
60k views

How I get SRID from Geometry field

What is the function for getting SRID from Geometry field. I have inserted a shapefile into SQL Server table with a Geometry field defined. I know the projection of shapefile is Swreff99_1800 (EPSG:...
user1899's user avatar
  • 1,427
17 votes
3 answers
14k views

Inverting Polygons using QGIS?

I have a Shapefile with Polygon features representing the world's land areas (continents, islands). Is it possible to invert these, and get a geometry that represents the world's oceans and seas? ...
kontextify's user avatar
17 votes
6 answers
12k views

Deleting duplicate geometry in PostGIS tables

After - I don't know what happened - all my entries in my PostGIS tables are doubled. I tried this to delete them but it does not delete any/all duplicates: DELETE FROM planet_osm_point WHERE ...
MartinMap's user avatar
  • 8,358
17 votes
6 answers
14k views

Converting between Esri Geometry and WKT using ArcObjects?

It seems like there is no means of converting an ArcObjects geometry to the Well-Known Text representation (and vice versa) in ArcGIS ArcObjects API. The only thing I was able to find is conversion to ...
Petr Krebs's user avatar
  • 10.3k
17 votes
3 answers
54k views

Removing duplicate features with same geometry in ArcMap?

Is it possible to uniquely identify each geometry in a feature layer? Essentially I have a polygon feature layer with many rows of data represented by the same geometry. I would like 1 row for each ...
Dylan Hettinger's user avatar
17 votes
2 answers
11k views

Correcting gaps and overlapping polygon (parcels) geometry

I have come across a resource that we rely upon almost daily that is in terrible need of repair. It is not our own product and the supplier is generally not interested in fixing the problem. We are ...
Michael Markieta's user avatar
17 votes
1 answer
16k views

Difference between bounding box, envelope, extent, bounds?

Every time when I create a script to manipulate vector (point, line and polygon) in python I meet this doubt. What is the difference between bounding box (bbox), envelope, extent, bounds?
Diogo Caribé's user avatar
16 votes
2 answers
4k views

What are the implications of invalid geometries

I've imported some data in a Postgis database and some of the geometries are reported invalid (ST_IsValidReason reports self-intersection or ring self-intersection). The queries I am performing don't ...
diciu's user avatar
  • 2,358
16 votes
5 answers
3k views

How to snap a road network to a hexagonal grid in QGIS?

I'm trying to use QGIS 2.14 to snap a road network to a hexagonal grid, but I'm getting strange artifacts. I've created a hex grid with MMQGIS, cells are approx 20 x 23 m. I've buffered the road ...
Steven Kay's user avatar
  • 20.5k
16 votes
3 answers
13k views

Exporting only certain columns to CSV file in ArcGIS for Desktop?

I've written a python script using arcpy which outputs a polygon feature class into a File Geodatabase. I have added a function to export the attributes to a separate CSV file. I am using the code ...
Fezter's user avatar
  • 21.9k
15 votes
5 answers
856 views

Terminology: Polygon or Area?

When writing about GIS geometry I'm unsure whether to use the term "polygon" or "area". In particular, does the word "polygon" suggest a specific type of geometry? For example, a colleague suggested ...
Mark Ireland's user avatar
  • 13.2k
15 votes
2 answers
20k views

Multipoint vs point PostGIS

Is it normal to use the geometry type 'multipoint' instead of 'point' knowing that I use it to store only one point? How can I convert from multipoint to point?
Youssef's user avatar
  • 375
15 votes
2 answers
6k views

Centroid coordinates for odd-shaped polygons

I have a problem in computing the centroids of certain polygons in QGIS (via the geometry tools): for certain polygons - with a strange and rather long shape - the centroids computed are off the ...
Andrea's user avatar
  • 181
15 votes
5 answers
30k views

Identify polygon containing point with R sf package

I would like to be able to map geocoded coordinates to a region on a .shp file in R using the sf package. I can load up the map and plot it but I am struggling with the code to return the region for ...
jmc's user avatar
  • 151
15 votes
3 answers
25k views

How to convert from SQL Server geometry BLOB to something else?

I have a CSV data file from a 3rd party that is an exported SQL Server table. They simply did a select * from foo and output the result to a text file and sent it over. In their table is column of ...
Peter's user avatar
  • 151
15 votes
5 answers
14k views

Python, shapely library: is it possible to do an affine operation on shape polygon?

I am trying to create a rotated rectangle in lat/lon coordinates. Basically, I have the coordinates of the center and rotation angle around the center. Is it possible to do using, shapely or gdal, ...
Oleksandr's user avatar
  • 253
15 votes
3 answers
5k views

What is "Fix geometries" tool actually doing in QGIS?

Sometimes geometry's have to be fixed for further processing. So you can use "Fix geometries" and it will do the job for you without prompting. But I'm wondering, what the tool "Fix ...
MartinMap's user avatar
  • 8,358
15 votes
3 answers
9k views

Calculating a spherical polygon centroid

I'd like a general way to calculate centroids for polygons on a sphere. So far, the best online reference appears to be: Tools for Graphics and Shapes by Jeff Jenness. The method described there ...
Jason Davies's user avatar
14 votes
2 answers
58k views

Calculating polygon areas and perimeters using QGIS

Using QGIS, if I load a polygon layer and make a new column, how do I fill that column with the area of each polygon and another column with the length of the perimeter of each polygon?
HealthMaps's user avatar
  • 1,005
14 votes
4 answers
8k views

In PostGIS: how to split linestrings into their individual segments?

I have one table with many linestrings and I want to make a new table containing the individual segments of all the linestrings, no matter if they are grouped line per line or not. This is my table, ...
Lorenzo Barbagli's user avatar
14 votes
4 answers
17k views

Changing (flipping) line direction in QGIS

I have a river network in QGIS. I draw opposite direction of one of the rivers. Now I want to change the direction of that river. How can I do that in QGIS 3? (As I know it is flip in ArcGIS)
Stepan Khachatryan's user avatar

1
2 3 4 5
38