Questions tagged [linestring]

A sequence of point coordinates referring to the line segments connecting them, as used to represent a one-dimensional feature or object.

Filter by
Sorted by
Tagged with
3 votes
1 answer
427 views

Getting the polygons contained in closed MultiLinestring using Python

Given a set of "streets", how can I get the "blocks" contained in those streets? For example, I'd like to extract four blocks / polygons from this 2 x 2 "checkerboard": ...
zadrozny's user avatar
  • 298
3 votes
1 answer
570 views

Shortening line with PyQGIS

I tried to shorten a given LineGeometry with some Python code. from qgis.utils import iface layer = iface.activeLayer() fs = layer.selectedFeatures() for f in fs: fg = f.geometry() ...
Peter's user avatar
  • 173
3 votes
2 answers
415 views

Selecting lines intersecting lines on two points in QGIS 3.14

I have two shapes of lines: one A with exploded red lines, the other B with closed black lines. In a virtual layer I want to select the yellow ones (A) i.e. those having only 2 points in common with B....
Leehan's user avatar
  • 1,236
3 votes
1 answer
629 views

Is there a way to calculate length of linestring from one point to another?

If I have one linestring and coordinates of two points on that linestring, what is the easiest way to calculate not shortest distance from those two points, but distance over the given road (given ...
Anastasia's user avatar
3 votes
1 answer
300 views

How to cut the end of line in a QGIS style?

I want to create a style in QGIS, in which one line is offset from the other, but their ends form one point (as in the picture). How do can you remove the ends of the green line? In QGIS 3.2 there ...
domiP's user avatar
  • 61
3 votes
1 answer
4k views

returning a LineString on selecting its midpoint

I have a list of shapely LineString, [<shapely.geometry.linestring.LineString object at 0x000001614D750CC0>, <shapely.geometry.linestring.LineString object at 0x000001614D750D68>, <...
FJ_Abbasi's user avatar
  • 611
3 votes
1 answer
4k views

PostGIS subquery make linestring from points

I have thousands of points and I am trying to intersect them with US states, sort them by date and then create a linestring from those points grouped by date, and state name. I have accomplished this ...
ziggy's user avatar
  • 4,515
3 votes
2 answers
1k views

Switch coordinates in linestring

I made a silly mistake: when creating linestrings in my PostGis database i inverted the lon and lat values. Which isn't a problem for postgis itself, but for my visualization and intersections. ;) Of ...
Sven Eppler's user avatar
3 votes
1 answer
2k views

clip linestring by length

Is there a way to clip a linestring based on distance? For example, linestring from a to b is 150 meters. I would like to get the linestring from a to a point that is is 75 meters away from a ...
Antony's user avatar
  • 925
3 votes
1 answer
401 views

Using GeoPandas object.touches(geometry array) to have full list of Trues and Falses

I try to pass a number of line strings inside the parentheses to have something like this in the output, I tried different formats but it did not work. a1.iloc[0].geometry.touches(a1['geometry']....
Gaff's user avatar
  • 121
3 votes
1 answer
226 views

How to get a smooth transition between startpoint and endpoint of a line in QGIS?

I have a layer with a few lines. They look very smooth in general, but there is a sharp edge at the start/endpoint of the line. Hot to eliminate that and get the blue dotted result line there?
POGO's user avatar
  • 294
3 votes
1 answer
738 views

Group geometry points and create a linestring for each group

I have a table of points at a Postgres database that have two main columns (geom geometry, time timestamp). I need a query to retrieve as linestrings or as array of the geometries the points that are ...
Jp98's user avatar
  • 53
3 votes
2 answers
2k views

Merge Linestring that intersects without making them MultiLinestring

I am working on PostGIS 2.5.3 and PostgreSQL 11.2 As seen in the example below, I have 3 LineString that I would like to Merge to form one single Linestring. The squares represent the vertices, so we ...
GuiOm Clair's user avatar
  • 1,191
3 votes
1 answer
689 views

Select only lines that touch both sides of polygon - PostGIS

I want to select lines that only touch both sides of a polygon. Is there a function in postgis that can do this? See image below. I only want to select lines from the circle on the left where the line ...
user1655130's user avatar
3 votes
2 answers
1k views

Shapely floating problems with split()

Based on the answer of sgillies I want to use Shapely's interpolate() to find the points at which to split. But I experience that split() is sensitive to the points being precisely on the geometry you ...
Joost Döbken's user avatar
3 votes
1 answer
3k views

Smooth linestring shapefile

Is there an algorithm to perform a smoothing of a linestring and maintain the original points?
Paulo Pires's user avatar
3 votes
4 answers
2k views

Redistribute linestring vertices to specified distance

I use a groundwater model program called GMS, and it has a very useful function "Redistribute vertices" (more info). I use this function all the time to both simplify and provide regular spacings ...
Mike T's user avatar
  • 42.1k
3 votes
1 answer
1k views

"One or more line ignored due to geometry not having a minimum of three vertices" error when "Line to Polygon" in QGIS

Converting "Line to Polygons" using geometry tools in Vector could not be executed results shows this picture How to solve this issues?
Alistair_KI's user avatar
3 votes
1 answer
525 views

Extract river nodes from linestring [closed]

I want to extract the coordinates of river confluences. I have a shapefile of rivers in a watershed. I want to get the coordinates of each point where a river joins another. import geopandas as gpd ...
pyaj's user avatar
  • 175
3 votes
1 answer
339 views

How to remove Topology Checker red dots?

How do I remove red dots created by topology checker? I was trying to check for overlapping lines within one layer by using the topology checker --> Must not have Dangles. This didn't work, I'm ...
Yelper's user avatar
  • 107
3 votes
2 answers
2k views

Is there a way to "sort" points in a MultiLineString such that they seem more like a continuous LineString?

Is there a way to "sort" the points of a MultiLineString such that they follow a more sequential order? Let me illustrate what I mean with a graphical example: Input Suppose I have the ...
Felipe D.'s user avatar
  • 2,509
3 votes
1 answer
1k views

Shapely strange splits when splitting LineString and Polygon

I noticed a strange behavior while splitting a LineString with e Polygon: in the below image I have a Polygon (in green) and two lines. If I split the blue Linestring with the polygon the result of ...
Domenico V.'s user avatar
3 votes
1 answer
624 views

Can't Form DataFrame from Parallel Offset Output

I've been developing code to take a .csv with lat-long coords and convert them to LineStrings before creating parallel offsets for them. This has been working so far, but yesterday after clearing my ...
vbray6's user avatar
  • 31
3 votes
1 answer
726 views

Is there a faster way to see if a polyline intersects itself?

I have several large polyline feature classes and I need to find how many times each polyline intersects itself (where it intersects is of no importance). I wrote the following code, which works fine,...
Mathwiz's user avatar
  • 152
3 votes
1 answer
999 views

Split lines in segments based on distances in Oracle

I have a data set consisting of 2D linestrings which are stored in an Oracle database in table my_lines with an id and a geometry column (units are in meters). In a separate table my_intervals with a ...
Chau's user avatar
  • 4,480
3 votes
1 answer
1k views

Determining if another marker (Point or Polyline) where marker Point dragged in Leaflet?

I'm trying to create interaction between 2 markers with Leaflet, I would like to be able to drag a marker onto another Either between one point and one linestring, or between 2 points. I added the ...
Thibault's user avatar
  • 141
3 votes
2 answers
4k views

Find a linestring closest to a given linestring

There must be already a solution to this problem - let's say we have five different linestrings. They might intersect or not. Given a sixth linestring, how do we find which one of the original five ...
kozyr's user avatar
  • 259
3 votes
4 answers
900 views

How to determine if two points are on the same side of a LineString?

I have two points, A and B, and a line string L. A line string is formed by a sequence of points such that consecutive points are joined by a straight line. This is the same as a LineString in Geos - ...
TCSGrad's user avatar
  • 141
3 votes
1 answer
1k views

PostGIS - Intersects feature to split into linestring

I would like to know if it's possible to intersect feature datasets (multipolygon, polygon, multilinestring and linestring) to get a result as a set of linestrings being split at each intersection ...
Below the Radar's user avatar
3 votes
1 answer
688 views

PostGIS: Using a polygon to 'mask' linestrings returns both multi and linestrings

I have a table of linestrings (OSM roads, in fact) that I'm displaying on a map. I want to filter them so that only those within a certain area are displayed- I've already done this with the coastline ...
Alastair's user avatar
  • 133
3 votes
1 answer
205 views

clustering similar linestring with direction in PostgreSQL(PostGIS)

Linestrings with directions are stored in the form of geometry in PostgreSQL, as shown in the figure below. I would like to cluster similar(location, length, and direction) shapes through functions ...
myskbj's user avatar
  • 91
3 votes
1 answer
2k views

Converting column with LineString geometries to np.array

I have a GeoDataFrame of a street network with the geometry of each row as a LineString. Say something like: type id tags geometry lanes bridge name highway 0 way 34953479 {'...
arkriger's user avatar
  • 327
3 votes
2 answers
249 views

Convert linestringz to linestringm using alter column?

I am attempting to import linestring data with or without m values, then test whether the data has m values, then add m values to the geometry if they are missing. So far, I have working tests for ...
jbalk's user avatar
  • 7,515
3 votes
1 answer
2k views

Get the outer shape of a MultiLineString

i have a bunch of shapely MultiLineStrings, which I would like to "convert" to Polygons so that the "outer" boundaries of the MultiLineStrings serve as edges. One of my ...
Ben's user avatar
  • 193
3 votes
2 answers
456 views

Merging average geometry of overlapping lines with differing nodes using QGIS

In QGIS 3.16 I've inherited a sloppy dataset of regional roads. My problem is this: Roads have been drawn over for updates and not deleted, leaving behind hundreds to thousands of overlapping ...
Olive's user avatar
  • 133
3 votes
1 answer
293 views

Polygonizing LineString features to Polygon features and keeping Attribute table values using PyQGIS

I am trying to create a circular raster in Qgis3.8.3-Zanzibar with the Python console. I am able to make it with LineStrings (combine of Polyline and Circular String) and fill each feature with ...
Sebastian's user avatar
3 votes
1 answer
3k views

How to transform Linestring to Polyline?

I have GeoJson file with roads data as Linestrings. I want to load it in Cesium Sandcastle and make a custom line styles. In order to do so, lines have to be Polylines, not Linestrings. Is there a way ...
Paula's user avatar
  • 49
3 votes
1 answer
2k views

From trajectory of GPS points to multiline segment?

Given a trajectory as a sequence of GPS points I would like to create a smooth linestring representing a path where a car drove. The data is stored in postgresql: the input trajectory in a table, ...
arthur's user avatar
  • 191
3 votes
1 answer
2k views

How to detect overlapping linestrings in PostGIS?

I'm looking for the fastest way to detect whether a given linestring overlaps another linestring. (As reference, let's say my wife and I both go for a run and take different routes, I'd like to detect ...
amcmanus's user avatar
3 votes
1 answer
696 views

Find polygon that contains all linestring records in PostGIS table

I'm still pretty new to this stuff, so bear with me. In PostGIS how could I find a polygon that would contain all the linestring records in a given table?
Eric Palakovich Carr's user avatar
3 votes
1 answer
130 views

How to split a linestring by its Z dimension

I have a tracks table with a geom column of type geometry(LineStringZM,4326). I now need to find out how much time a user has spent at a given elevation range. For this I'm gonna create a materialized ...
shabushabu's user avatar
3 votes
1 answer
480 views

Automatically delete side branches from a multipart linestring in QGIS

Question I have a multipart line representing a river, downloaded from OSM. It includes minor branches as well (see screenshot). For cartographic purpose, I want to convert the line to a single part ...
Babel's user avatar
  • 71.2k
3 votes
1 answer
322 views

Selecting single line after polygon is split into line segments

In QGIS 3.20 on Windows 10 Pro 64-bit I have used the menu sequence Vector/Geometry Tools/Polygons to lines to create a new line layer from a polygon layer which contains several polygons. However I ...
Bill C's user avatar
  • 967
3 votes
1 answer
263 views

How to split several lines by one polygon and get the distance of each part using sf?

The question "How to split one line by several polygons" already has an answer here. My question is similar but different: How to split several lines by one polygon? The context: I have a ...
Antonin's user avatar
  • 865
3 votes
1 answer
229 views

Combining linesegments that are contionous into one feature in QGIS 3.10.7

I have a dissolved line, where I have clipped some segments where I would like to create a feature for each individual segment. I have tried using "Vector Geometry -> Multipart to singlepart&...
seini's user avatar
  • 197
3 votes
1 answer
2k views

How to find and remove invalid geometry in a multilinestring python geodataframe?

I have original data as a 700000's rows excel, with geometry data in hexwkb format. I want to plot it and make some spatial operations on it like intersect, distance and buffer, on a jupyter notebook. ...
danalif's user avatar
  • 171
3 votes
1 answer
510 views

Determining direction of traffic in road network?

I'm working with road segments as LineStrings in GeoPandas, for each segment I would like to determine the direction of travel (they drive on the right). This information is not encoded, how can I ...
William Grimes's user avatar
3 votes
1 answer
2k views

Creating Multipolygon Shapefile from MultiLineString GeoJson using ogr2ogr?

Right now I have a GeoJson file with a structure like this: { "geometry": { "type": "MultiLineString", "coordinates": [ [ <Coords line 1> ], [ <Coords line ...
CRE's user avatar
  • 85
3 votes
1 answer
607 views

Bring a list of unsorted linestrings in order so that they form a path from origin to destination

I have a table of linestrings together with some attributes that, when displayed all at the same time, represent a connected path from an origin to a destination (each linestring has one predecessor, ...
Dirk's user avatar
  • 1,841
3 votes
1 answer
2k views

How to find a point on linestring and in a range of 10 meter

i have a linestring which is show in diagram and i have a point which is some time on the linestring or out of linestring but in range which is red line and some time its is out of range so how can i ...
Ashish Srivastava's user avatar

1 2 3
4
5
11