Questions tagged [geometry-conversion]
A change from a geometry type to another, e.g., points to lines, lines to polygons, polygons to points, and the like.
166
questions
41
votes
6
answers
121k
views
Drawing lines from points in QGIS
I have a point layer and need to draw a line passing through or in the vicinity of the points (up to 0.5m distance between the point and the line).
The nodes of the line will receive the attributes of ...
33
votes
2
answers
41k
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, ...
27
votes
6
answers
25k
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.
25
votes
6
answers
69k
views
Converting polyline to polygon in 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 ...
22
votes
2
answers
50k
views
Creating polygon layer from polyline layer in QGIS
Our systems expect polygon shapefiles, representing a collection of non-intersecting and geometrically valid (Multi)Polygons. Specifically, farm fields. We often receive our representations of farms ...
19
votes
5
answers
28k
views
Converting polygon into single or all points in QGIS
I want to convert polygons into points using QGIS.
I know how it's done in ArcGIS Desktop.
How can I implement it using QGIS?
16
votes
4
answers
39k
views
Transforming polygon to linestring in QGIS
I have a polygon, imported from a shapefile in QGIS. I would like transform it to a linestring instead so I can save it as a GPX file later.
How can I transform a polygon to a linestring in QGIS?
16
votes
2
answers
639
views
Transferring flows (connections and values) between polygons in QGIS
In QGIS there are two shapefiles representing the moving data between cells and one additional layer, see image below
Moving data defined by:
A polygon 'LayerA' (transparent squares with red outline)...
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 ...
13
votes
4
answers
18k
views
Getting all the points of polyline
I have some polyline feature objects in Python. Now I want to get all the points of polylines.
For example, if a polyline has start point [0,0] end point [5,5].
Result: [1,1];[2,2];[3,3];[4,4];[5,5].
...
13
votes
1
answer
8k
views
Creating line from points using PostGIS?
I have a PostGIS table with position data of numerous vehicles and want to create lines from these points.
Data can be selected by vehicle id and ordered by timestamp but how to create lines from ...
12
votes
5
answers
65k
views
Creating polygons from lines using ArcEditor/Standard level license of ArcGIS Desktop?
I am trying to create polygons from a line layer of lots and concessions (large blocks of land in rural areas).
The lines are mainly grid style as they intersect mostly at right angles.
I need to ...
12
votes
6
answers
7k
views
Generate polygons from a set of intersecting lines
This is a simple and quite common question which has already been asked for different purposes (see this link and this too, for example), here, however, we are looking for not a software package but ...
11
votes
4
answers
23k
views
Python Library for converting GeoJSON Multi-polygon to polygon
I would like to know if there is a Python library that can be used to convert GeoJSON Multi-polygon to a Polygon.
Note: i want to convert .geojson file Multi-Polygon feature type to Polygon feature ...
11
votes
6
answers
9k
views
Lines to Polygons
I have failed to find the "name" of the algorithm that would allow one to convert lines to polygons. Since this issues crosses GIS and the fields of computational geometry and computer science. I am ...
11
votes
1
answer
19k
views
Polygon to Point in GeoPandas?
I want to convert a shapefile from polygon to point:
pfile = pathtofile
file = gpd.read_file(pfile) #it is a polygon
Searched this site but didn't find anything similar:
http://geopandas.org/...
9
votes
2
answers
18k
views
How to convert a line to points?
I'm working with QGIS and I want to convert a line into many points, does someone know how?
9
votes
1
answer
57k
views
Convert polygon to point with QGIS [duplicate]
I work with QGIS and I tried to convert polygon into point. I need points all over the perimeter of the polygon. I saw several answers like:
Problems converting polygon to point
but I didn't see an ...
8
votes
6
answers
3k
views
Creating all possible line segments between all points using QGIS
I want to connect all points in a point feature with every possible line segment using QGIS.
For example, how a pentagon has five points with ten line segments connecting them all to form a pentagram ...
8
votes
2
answers
661
views
Changing polygon circles to hexagons using QGIS
I received an answer to Changing Points into Hexagon-Polygons using QGIS, which enabled me to change the point to polygons using the "Rectangles, Ovals, Diamonds" tool, which I used circles.
...
7
votes
3
answers
634
views
Creating bar chart from point layer using QGIS Geometry Generator
From a layer with point geometry, I store the following fields:
"CATEG" which can be A or B
"ORDER" which is an autonumeric field sequence without repetitions
"VALUE" ...
7
votes
3
answers
3k
views
Can't transform lines to polygons
I have a similar question to:
How to join lines in QGIS for later using "lines to poly"?
I have a line shapefile that I wish to transform into a polygon shapefile.
After making some ...
7
votes
1
answer
8k
views
Fast way to convert Polygons to Points in PostGIS
What's the fastest way to convert a polygon to a point in PostGIS?
I don't care where the point is in relation to the geometry, but the resulting point does need to be consistent.
Using ST_Centroid ...
7
votes
2
answers
330
views
Generating polygonal blocks using growing lines
We first generate a set of locations (i.e., points(x,y)), randomly. Then we assign for each point a number showing the angle of a line being centred at that point. The criteria for the length of lines ...
7
votes
1
answer
1k
views
How to connect particular sets of points with (poly)lines?
I have a timestamped point-table representing GPS-tracked places of different cars. To distinguish the cars there is a car-id for every point. So, a simplified version is looking like that:
Now, I ...
6
votes
3
answers
3k
views
Getting centroids for multiple lines in QGIS
Is there a possibility to get the centroid of each line?
When using Vector > Analysis Tools > Mean Coordinates I always get a centroid of the whole lines. What I need is the centroid of each ...
6
votes
1
answer
476
views
Changing points into hexagon polygons using QGIS
In QGIS 3.18, I need to convert vector points into polygons for a client and there was a plugin that did this in QGIS 2 but I can't find anywhere in the questions that shows me how to do it.
The ...
6
votes
3
answers
7k
views
Converting SpatialLinesDataFrame to SpatialPointsDataFrame in R?
In R I have a SpatialLinesDataFrame (for example from a coastline shapefile) and I want to convert it to a SpatialPointsDataFrame. I want to keep all the vertices from the line shapefile to become ...
6
votes
4
answers
3k
views
Generating line segments between all points using QGIS
How do I create a vector layer with a network of line segments drawn between every point in another vector layer?
Basically, I am trying to create something similar to a hub/spoke network, except that ...
6
votes
1
answer
208
views
Creating straight line that starts from the point with the given length and also rotates around the point in QGIS
I want to create a straight line that starts from the point with the given length. And also it rotates around the point.
I have a point data of cctvs:
And I want to create a line with the given ...
6
votes
2
answers
6k
views
Create Polylines from arrays of points
Let me describe the data setup. A line has been provided as an array of coordinate pairs, one for each vertex. This array is variable in size, anywhere from 2 to 200 coordinate pairs per line. What I ...
6
votes
1
answer
2k
views
How to transform WRF Spherical Earth to WGS 84?
Weather Research Forcasting Model assumes a spherical earth model with a radius of 6370km. I'm looking to display the data onto the WGS-84 Ellipsoid model as that is the model my system uses for its ...
5
votes
2
answers
4k
views
Vector -> Geometry Tools -> Extract Nodes equivalent in PyQGIS API
What is the PyQGIS equivalent of the Extract Nodes tool in QGIS?
I cannot seem to find it in the API documentation.
5
votes
1
answer
1k
views
Convert linear polygons to lines
I have some long linear polygons that I'd rather store as lines but I'm not sure how best to do this. Ideally I'd have a line going through the centre of the polygon lengthways. I have two ideas of ...
5
votes
1
answer
336
views
Creating new layer with all attributes inherited from original layer using PyQGIS
Let's assume there is a polygon layer called 'test2' with its attribute table, see the image below.
With the code below I am creating a new layer as centroids of original features
layer = iface....
5
votes
1
answer
6k
views
Exploding line into segments using QGIS [duplicate]
Is there a command to explode a line feature (with many segments) into its segments?
Like this:
I have seen this: Splitting all lines in layer at vertices using QGIS
But, I was looking for something ...
5
votes
1
answer
2k
views
Changing geometry types from kml points Z to just points in QGIS
How do I change geometry types from pointZ to point in QGIS from a kmz file?
5
votes
2
answers
4k
views
Convert shapefile lines to a polygon in GRASS
I have a shapefile of a map that is the outline of a number of islands. I would like to convert the lines into polygons (ie all islands filled in) using GRASS. I searched on how to do this with GRASS ...
5
votes
2
answers
1k
views
When does Shapely's "polygonize_full" detect a dangle?
Shapely's polygonize_full operation, which merges line segments into polygons, returns four geometry collections: polygons, dangles, cuts and invalid ring lines. Dangles are defined in the ...
5
votes
3
answers
1k
views
Convert polyline with Left ID and Right ID to polygons with ID
I have a polyline shape file which contain Left Id and Right ID information and struggling in converting this polyline layer to polygon with ID via arcpy.
I am using ArcGIS(editor) license so feature ...
5
votes
1
answer
16k
views
How to convert lines to polygons using NetTopologySuite?
I am trying to convert lines to polygons using NetTopologySuite(a C# port of Java Topology Suite JTS). I ran the sample console code succesfully and it generated two polylines.
I then tried to run ...
5
votes
1
answer
2k
views
Generating polygons with streets as borders using QGIS?
I have searched online for almost a week and can not find an answer to my issue.
I need to generate polygons from street borders in a given city.
I have downloaded data from openstreetmaps and ...
4
votes
1
answer
186
views
Creating horizontal lines connecting points using QGIS Geometry generator
I am using the geometry generator to learn how to generate vectors using expressions. Currently, I have a point vector, and I would like to create horizontal lines (shown in red: manually drawn) ...
4
votes
3
answers
5k
views
Merge single points to multi point geometry
Is it possible to transform a point shapefile in single part geometry to a shapefile with multi-point geometry based on an attribute.
e.g. in the file are 50.000 records in 700 categories, now I want ...
4
votes
1
answer
144
views
TypeError when converting QgsMultiLineString to QgsGeometry using PyQGIS
I have previously written some PyQGIS code to replace the features in a LineString layer with new features. The outline of the code is below - I have left out the specific code to create data for the ...
4
votes
1
answer
643
views
Incorrect ST_Area after changing to 4326 in PostGIS
I'm trying to change the geometry in our database from 3857 to 4326 so that I can use more functionality within PostGIS. It converts them all properly when I run the alter column and transform query:
...
4
votes
2
answers
2k
views
GeoJSON to CSV with geometry using QGIS
I downloaded a GeoJSON file from vangdata.carto.com and I'm trying to convert it to CSV that has geometry data in tact. I'm trying to achieve the same result as a CSV file when exported from public....
4
votes
1
answer
347
views
Using `CAST` and `ST_UNION` in same query in PostgreSQL
I want to union the geometry of waterlines grouped by a table column in a new view.
My problem is that I apparently needes to specify the geometry type using CAST function. But I cannot figure how to ...
4
votes
1
answer
227
views
Geting midpoint of MultiLine in QGIS
I have a line(multiline) layer in QGIS 3.22. I need to place a point in the middle.
I've tried using the algorithms: "interpolate point on line" and "points along geometry", by ...
4
votes
2
answers
3k
views
QGIS split rectangular polygon in grid
I have this selected rectangular polygon in yellow on a layer with hundreds of polygons:
I need to split the selected polygon in 4 vertical columns (Y axis) and 8 horizontal rows (X axis), so that I ...