# Tag Info

### Drawing wavy/wiggly lines in QGIS

Short answer: you can get it using a custom SVG. See bottom of this post for one. Long answer: I believe it is better to represent it than to modify the line geometry. Should you want to move an ...
• 42.3k
Accepted

### Drawing wavy/wiggly lines in QGIS

I propose a solution using PyQGIS. It should work both for Linestring and MultiLineString layers. This solution is based on the creation of semicircular rings, so you need to set a value for the ...
• 16.3k

### Generating start and end points for LineStrings

If you have QGIS 3.4 you can use Extract specific vertices tool to extract the endpoints by inputting 0, -1 at the vertex indices as you can see below: The tool is located in Processing toolbox -> ...
• 41.1k
Accepted

### Turning GeoDataFrame of x,y coordinates into Linestrings using GROUPBY?

I think I found an interim solution, which I'm posting in case it's useful for anyone: import pandas as pd import numpy as np from geopandas import GeoDataFrame from shapely.geometry import Point, ...
• 1,549

### Is the LineString straight?

Maths should always work. You can basically test for the collinearity between the first vector of the line (i.e. composed by the two first points of the line) and all other vectors of the line (i.e. ...
• 10.5k

### Is the LineString straight?

A really simple way is to evaluate the sinuosity for each linestring, using something like this for shapely: def sinuosity(geom): assert geom.geom_type == "LineString", geom.geom_type ...
• 42.2k
Accepted

### Extracting points from LineString or Polygon and making dictionary out of them in GeoPandas

I had the same question, here we can use a lambda function: import geopandas as gpd gdf = gpd.read_file('some_lines.shp') Say your GeoDataFrame looks like this: id xs_ID Orientatio ...
• 176

### Drawing wavy/wiggly lines in QGIS

Attention! This answer is outdated. Please follow the link here: Custom QGIS linestyle expression function won't work with MultiLineStrings In QGIS 3.10 it's possible to dynamically create zig-...
• 5,893
Accepted

### Creating one meter line from a point in the direction of a other line using PyQGIS

Change the for loop as follows: for point_feat in point_layer.getFeatures(): point_geom = point_feat.geometry() nearest_ids = line_index.nearestNeighbor(point_geom.asPoint(), 1) ...
• 77.3k

### Generating start and end points for LineStrings

You can also use a Virtual layer (Data Source Manager > Virtual Layer) with SQL: select id, st_endpoint(geometry) as geometry from lineshp union select id, st_startpoint(geometry) as geometry from ...
• 7,491

### Is the LineString straight?

A possible approach in QGIS using the sinuosity() function. Returns the sinuosity of a curve, which is the ratio of the curve length (length()) to the straight (2D) distance (straight_distance_2d()) ...
• 33.4k
Accepted

### Getting Polyline (Linestring) coordinates from line layer in QGIS

First, add a field (name: geometry, type: string, length: 1000 keep it long). Then use the following script: lyr = iface.activeLayer() with edit(lyr): for f in lyr.getFeatures(): f["...
• 77.3k

### Quantizing the value of straightness or waviness of line segment in QGIS

You can use QGIS expression with the sinuosity() function: sinuosity(\$geometry) Returns the sinuosity of a curve, which is the ratio of the curve length to the straight (2D) distance between its ...
• 73.3k
Accepted

### Adding offset to GeoJSON layer in Leaflet?

According to Romain D on it1me.com, it can be done with the Leaflet.PolylineOffset as referenced in the comments by MattPil29 above. I have adapted it for the data in your example. I turned off your ...
• 1,238
Accepted

### Converting polygon to lines without duplicate edges?

If you are not forced to use QGIS, another Open Source GIS software OpenJUMP http://openjump.org/ has a Planer Graph tool that may be exactly what you need. Here you can find the tool. If you need ...
• 67.4k

### Drawing wavy/wiggly lines in QGIS

An expression that solves this was added to QGIS 3.24 (https://github.com/qgis/QGIS/pull/45583). Use this expression in the Geometry Generator: wave(\$geometry, 15, 3)
• 2,326
Accepted

### "AttributeError: 'GeoSeries' object has no attribute 'coords'" when accessing coords property of LineString using GeoPandas

A GeoSerie is a list of shapely geometries, therefore with shapely from shapely.geometry import LineString, shape line_new = LineString([(0.3, 0.6), (1.5, 1.6), (0.9,2.5)]) type(shape(line_new)) &...
• 55.1k

### Can I reorder the coordinates of a line when importing into QGIS a WKT linestring?

Since you have successfully imported data, use the tool presented in the figure. QGIS 3.4
• 4,467
Accepted

### Randomly offset duplicate points along linestring X meters using PostGIS

Update duplicates with a randomly interpolated point on the nearest line, e.g.: UPDATE <points> AS pt SET geom = ( SELECT ST_LineInterpolatePoint( ln.geom, -- ...
• 30.5k

### Randomly offset duplicate points along linestring X meters using PostGIS

Group by geometry to find the duplicates, join the line to the points, interpolate the duplicates at a random distance along the line, union with the non duplicates: --Find the duplicates by grouping ...
• 75.2k

### Finding and merging lines that touch in PostGIS?

Another option: use the PostGIS ST_LineMerge function. Here's the previous example redone with it: WITH data(geom) AS ( VALUES ('LINESTRING (0 0, 1 1)'), ('LINESTRING (2 2, 1 1)'),...
• 5,143
Accepted

### How to calculate distance from POINT to LINESTRING in R using `sf` library and get all POINT features from LINESTRING where distances were calculated?

While sf package don't have a built-in function or geosphere is not compatible with sf objects I would use a wrapper around geosphere::dist2Line function: just getting the matrix of coordinates ...
• 3,176
Accepted

### Concatenating string with space

You need to use single-quote (') for hardcoded strings and double-quote (") for fields reference: Try with that: concat('LINESTRING(', "X", "Y", ' , ' , "new_X", "new_Y", ')')
• 2,895
Accepted

### r - sf::st_cast("LINESTRING") - keeping first linestring only warning

One alternative, to apply an st_cast to "LINESTRING" over each row: > do.call(rbind,lapply(1:nrow(df),function(i){st_cast(df[i,],"LINESTRING")})) Simple feature collection with 6 features and 1 ...
• 65.3k

### Measuring / calculating curvature of linestring using QGIS?

Some of many (somewhat hacky) solutions using the field calculator: select to add a field with type BOOLEAN use one of the expressions (returning true when line is curved) area( convex_hull( \$...
• 30.5k

### Creating polygon from two not connected linestrings using shapely

You can get the lines' coordinates and use them to make a polygon. But it depends. In many cases, you will probably have invalid polygon. Let's make two lines using the coordinates in your question: ...
• 77.3k

### Determining what lines have changed in updated shapefile using QGIS

There is a new tool which was added in QGIS 3.12 called "Detect dataset changes" that does exactly what you want. It accepts any geometry type including line. The tool Compares two vector ...
• 41.1k

### How to perform SIA or Bezier line smoothing in PostGIS?

I created a small, naive script which converts input LineStrings to CompoundCurves based on some heuristics. What it does: Cuts down sharp corners to create a visually more appealing results than ...
• 4,598
Accepted

### How to split overlapping linestrings?

You will need: 1) A table with LineString geometries: CREATE TABLE lin ( id serial PRIMARY KEY, geom geometry(LineString, 31370) ); CREATE INDEX ON lin (id); CREATE INDEX ON lin USING gist (...
• 2,097