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
1answer
49 views

Creating LINESTRING from two POINT(s) and finding mid-POINT

I would like to create a LINESTRING from two POINT geometries and then determine the mid-POINT. So, from my original Pandas' DataFrame, with "x" and "y" columns, I created the ...
0
votes
1answer
40 views

Splitting linestring only when another linestrings endpoint intersects using QGIS

Using QGIS, is it possible to split all the linestrings in a file only if another linestring's endpoint intersected the linestring but not if they completely cross each other? For example, the image ...
0
votes
1answer
36 views

Join linestrings PostGIS

I have a PostGIS layer with linestrings, all linestrings are cut in each line intersection. The linestrings have no other information than the geometry and an unique id for each linestring. I would ...
2
votes
0answers
32 views

Create MultiLineStrings segments between points with Python Shapely

I have a layer of LineString and MultiLineString geometries. I'm trying to create a single geometry of the LineStrings split by certain snapped points. This is an illustration of the current data that ...
1
vote
0answers
48 views

QGIS Difference Algorithm: multilinestring won't work with multipolygon layer

I am working with two vector layers in QGIS (location: Indonesia). I want to 'subtract' the area of layer 1 ('Forest_buffer') of layer 2 (Scenario_1). I am using the Difference algorithm. Layer 2 is ...
0
votes
0answers
43 views

Extrapolating arc via Python function

I am looking for a Python code/function that can extend an arc linestring up to a pre-defined length while maintaining the same arc of the original line. The idea is to repeat the configuration of the ...
3
votes
1answer
59 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 ...
2
votes
0answers
33 views

Geometry Type error preventing saving of layer after editing - geometry type is correct under layer information

I have a problem with a linestring layer that doesn't want to be saved after editing. The layer itself shows 'LineString' under the information tab. When I add a line with the tool by snapping the ...
2
votes
0answers
26 views

Adding KML linestring intersection points to relevant linestring coordinates using QGIS

I have a KML document with many LineStrings which I'm parsing and building a graph from in an application. Unfortunately not all LineStrings line up correctly (having the same vertex/coordinate), and ...
2
votes
1answer
38 views

St_intersection doesn't give the correct response

I have two LineString and I want take their intersection. I don't understand why PostGIS doesn't give me the correct answer. select ST_Intersection(st_geomfromtext('LINESTRING(2.9363672 36.769075,2....
2
votes
1answer
61 views

Create linestring from coordinate values in text array after rounding to 3 decimal points

I have a table like; Id coordinates (text[]) 1 {"609275.485000001 4253109.911000001","609275.257 4253109.641000001"} 2 {"617784.171 4268033.896000001","617783.868 ...
1
vote
1answer
54 views

Iterating through QgsFeatures in active layer and adding label using PyQGIS

I am trying to plot contours that are stored in a shapefile (linestrings) with labels that have their value. I know how to get the feature attribute I want in Python via: name = "MSLP" ...
0
votes
1answer
25 views

Reproject geometry around a linestring

I'm trying to build a graph or a map which would show the below example route as a straight line and so would require the geometries of the countries to be reprojected about each leg of the route. It ...
1
vote
3answers
185 views

Python Create Dictionary with Shapely Points from Linestring coordinates

I have a Geodataframe with Linestring Z geometries as follows: id_line geometry 1 LINESTRING Z (0 0 0, 5 6 9, 1 2 3, ...) 2 LINESTRING Z (7 8 9, 9 8 7, 1 2 5, ...) each of the Linestring is made ...
0
votes
1answer
57 views

Sides of the polygon marked after deleting the OpenLayers layer

In other Q&As on the site, @QuentinN helped me to delete the added lines when the user clicks on the map. They are partially erased and the rest stays there and I don't know why ... The name of ...
0
votes
1answer
52 views

Delete the newly created OpenLayers string line

Create line strings to display the size of the sides of a polygon when selected by the user. Here you have code: var array_coordinates = feature.getGeometry().getCoordinates(); for (var o = 0; o < ...
1
vote
1answer
74 views

Creating Python code to pin and rotate fixed length segment using shapely

I am very new to Python GIS. I am creating code in Python using shapely geometry library. One of the goals is to create a fixed length segment, pin one end of it to a known coordinate and rotate the ...
2
votes
1answer
80 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 ...
1
vote
1answer
24 views

Order and orientation of pgRouting result

I have a routing application based on pgRouting and OSM data. When I generate a route from coordinates A to B, it works well, but when I export the geojson to GPX format, I notice, that some ...
0
votes
0answers
35 views

Finding the angle between two GIS linestring features using R

I have two simulated linestrings, one that represents a satellite ground-track and the other representing a linear surface feature (e.g., sea ice lead, road or river). I'm trying to determine how to ...
2
votes
0answers
69 views

How to merge lines from shapefile using PyShp and Shapely and save them in a new shapefile?

I have files with line segments that cover road network of towns. The issue is that each street with specific name consists of smaller segments that I need to merge into one line covering the whole ...
2
votes
0answers
61 views

Calculating length along multiple line segments in GeoPandas [closed]

I would like to calculate the distance between two points. They are connected with multiple line segments. Each LineString only consisting out of two points. How do I connect these LineString segments ...
0
votes
1answer
87 views

Interpolating LineString by adding new Point in middle between each two points [closed]

I want to add interpolated points in a LineString using shapely. The interpolated points should be in the middle of every two Points present in the LineString. The shapely interpolate function adds ...
2
votes
1answer
65 views

Shortening line with PyQGIS

I tried to shorten a given LineGeometry with some Python code. layer = iface.activeLayer() fs = layer.selectedFeatures() for f in fs: fg = f.geometry() geomSingleType = QgsWkbTypes....
0
votes
0answers
20 views

PostGIS geom line string to display in Django map

I would like the WKB PostgreSQL geom data (extracted from a shapefile) in the below table to display in a django web app. I have previously successfully mapped points to a Django web app from a ...
3
votes
1answer
74 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 ...
1
vote
1answer
266 views

Shapely command error: from shapely.geometry import LineString

I am trying to run a program but getting the following error when I am using the command: from shapely.geometry import LineString Error: FileNotFoundError: Could not find module 'C:\Users\SWWB\...
2
votes
1answer
319 views

Is it possible to remove select geometries from GeometryCollection elements within Google Earth Engine?

I am relatively new to Earth Engine and am trying to understand GeometryCollection elements. I have seen this post, but otherwise haven't found much additional information. Coming from desktop GIS ...
7
votes
2answers
119 views

Change linestring values with GeoPandas

I'm working on a stormtracking project, and I realized that the longitude sign of some values in my GeoPandas dataframe are wrong; i.e. I need negative longitudes instead of positive ones. When I ...
2
votes
1answer
56 views

Affine Tranformation Matrix; shapely asks 6 coefficients, but rasterio delivers 9; how to translate

Some lines have been extracted via scikit-image, now tho goal is to vectorize them within the origin coordinate reference system #some geotif opened with rasterio src = rasterio.open(raster_path) ...
3
votes
1answer
87 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?
0
votes
2answers
150 views

Calculating isochrone for linestring

I have seen APIs and algorithms for calculating isochrones for a single point, e.g. https://openrouteservice.org/dev/#/api-docs/isochrones. Is it possible to calculate the isochrone for a line segment,...
6
votes
1answer
214 views

Creating polygon from two not connected linestrings using shapely

I'd like to know if there is a way to create a polygon in shapely from two not connected linestrings. I've been struggling with this question from some hours now and I can't find a way to deal with it....
2
votes
0answers
38 views

Line is not displaying where lat and long define

I have created 3 lines by importing them into QGIS 3 with the Add Layer/ Delimiter Text option and it does display on the map (I have added an OSM layer to understand where the line is located) but ...
1
vote
2answers
29 views

Storing information for each segment of spatial line

I have some spatial lines from a shapefile representing roads. I'd like to attribute to each segment an information, for example the state of the segment or more generally a scalar that gives an ...
0
votes
1answer
424 views

Calculating distance between two Linestring using Python

I have two linestring, each linestring represents a rail road. I am trying to calculate minimum distance between these two linestrings. Which function is efficient to do this? I have only come across ...
2
votes
1answer
117 views

Drawing LineString to right (horizontal) direction only

We use Vue.js 2 and OpenLayers 4.6.5. The picture looks as folowing: The user draws the first line, for example, from the bottom upward and makes a click to finish the first line. Then he draws next ...
1
vote
1answer
206 views

Does a common algorithm exist to find the midpoint of a linestring by distance within a coordinate system?

Recentl I needed to find the mid-point of a linestring. I work with java/Scala so I naturally reached for the JTS library but couldn't find anything in there for doing this. I implemented an algorithm ...
1
vote
0answers
44 views

R: Find parallel line strings and keep only one

For a project I use OpenStreetMap road data. However, if multiple roads are parallel to each other (say within 30 meters), I only want to keep one line, not both. See this example where a part of the ...
0
votes
1answer
43 views

Multiplying z values in linestringz shapefile with a constant [closed]

I have National Levee Data (NLD) shapefile for the entire US in a linestringZ format. The unit of Z values in the shapefile is in feet, but I need it in meters. So, I want to multiply all z values ...
4
votes
1answer
364 views

Getting Polyline (Linestring) coordinates from line layer in QGIS

I have a road network (line layer). I am trying to get list of coordinates (Lat,Long) from road network in the form of geometry LINESTRING as shown below. However, I am only getting two coordinates as ...
4
votes
2answers
206 views

Merging two isolines into one in PostGIS

How can I sum two isolines A and B (closed linestrings with values) into one isoline C with summed values on common parts? For each line string there is a value and I would like to sum on common part. ...
0
votes
0answers
54 views

How to connect GeoJSON LineString coordinates with a shortest distance

I have the following GeoJSON LineString that I generate from some data (that I don't own). The problem is that when this line is rendered, the 2nd coordinate (with a positive longitude) of the line is ...
0
votes
0answers
21 views

Casting 2 separate LINESTRINGS from 2 sets of POINTS that are close

I have POINT data that comes from the GPS records of the movements of a species. I'd like to calculate the length of their trajectories when they fall within a grid cell. Sometimes a species comes in ...
1
vote
2answers
221 views

Removing longest segment of linestring and rejoining segments

I am trying to remove the segment that has the longest length from a linestring and join the two group of segments that remain by the shortest segment between them. That was easy, using ST_Difference (...
4
votes
2answers
225 views

PostGIS: Single side ST_Buffer of linestring produces strange output

In the example below I have a linestring PostGIS table (in black and yellow) and a single sided ST_Buffer output polygon (in red). The buffer distance is based on an attribute value stored in the ...
2
votes
1answer
137 views

Casting LineString to Polygon results in ClassCastException when y coordinates are the same

final WKTReader wktReader = new WKTReader(); String geomString = "MULTILINESTRING ((-98.753985 34.63093, -98.7555568 34.63093))"; MultiLineString geom = (MultiLineString)wktReader.read(...
0
votes
1answer
27 views

How to add intersection vertices to a ShapelyLinestring?

Assume that I have two shapely LineStrings. I want to find their intersection and then add the intersection point as vertices into the respective LineStrings. from shapely.geometry import LineString #...
2
votes
1answer
251 views

Density per grid cell

I have a shapefile with the following format. These are storm tracks and each unique "Serial" represents one storm track. import matplotlib.pyplot as plt import geopandas as gpd input = &...
3
votes
2answers
169 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....

1
2 3 4 5
9