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
13
votes
1answer
19k 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?
12
votes
2answers
3k views

Grouping connected linestrings in PostGIS?

I have a table of streets I've selected based on a set of attributes (let's say it's speed_limit < 25). There are groups of streets that are locally contiguous; I'd like to group these sets of ...
13
votes
1answer
3k views

Detecting if point is on left or right side of line in PostGIS?

I have a linestring table and a point table in postgis. I know the closest line to any given point. What I need to know is on which "side" of that line is the point. I guess I have to do that by ...
9
votes
3answers
3k views

How to perform SIA or Bezier line smoothing in PostGIS?

Can anyone provide an example SQL for smoothing linestrings from postgis table using Bezier curves or Iterative Averaging (SIA) algorithm?
4
votes
2answers
11k views

How to find nearest line from point using PostGIS?

I have a table of Roads in PostGIS which geometry is "geometry(MultiLineString,4326)". Its attribute are gid osm_id name ref type oneway bridge maxspeed geom Now i want to know the ...
10
votes
2answers
1k views

QGIS Extract Nodes with M-Values for Linear Referencing

I have a MultiLineStringZM layer in a sqlite database, and I'm trying to visualize the measures or m-values at the vertexes. I've tried looking up information on how to do this in QGIS, and about all ...
5
votes
2answers
4k views

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

I'm trying to calculate distances from a set of POINT features (1, 2, 3, 4, 5, 6 & 7) to a LINESTRING feature using sf library in R. I could calculate all the distances using the function ...
21
votes
2answers
1k views

Drawing wavy, wiggly lines in QGIS?

Is there a QGIS function or plugin to draw wiggly line? I have used Spline Tool to manually draw some waves, but it is time consuming. If possible, I would like to draw something like: Inkscape ...
8
votes
1answer
3k views

How to create linestrings with a definite angle and length, that are fixed to a point

I want to create linestrings with a definite angle (e.g. 160°) and length (e.g. 2m) that are fixed to a number of points of another linestring. So, I want to use the ST_DumpPoints function to find the ...
9
votes
4answers
12k views

How to extract POINT from a [LINE|MULTILINE]STRING

I'd like to create a vectorLayer in QGIS to display all the points that form a LINESTRING or a MULTILINESTRING stored in a PostGIS DB. I think that I need to transform all points of LINESTRING (or ...
5
votes
1answer
3k views

How to extend a straight line in postgis?

I have a postgis table of simple linestrings, each one is a straight line with just two points. I want to select every linestring, but extended from both sides by 1 meter. So i have lines, that are ...
7
votes
1answer
3k 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, ...
7
votes
2answers
1k views

Converting polygon to lines without duplicate edges?

This seems like it should be easy, but I'm not figuring it out: How do I convert a polygon layer into a line layer representing the polygon edges, where each edge belongs only to a single feature (or ...
15
votes
1answer
2k views

How to see what lines have changed in an updated Shapefile?

I'm using my county's GIS data to update the roads in OpenStreetMap. I have a copy they published last year and one that was just published, and I'd like to find all the LineStrings that have either ...
15
votes
3answers
871 views

How to create lines to visualize differences between polygon features in PostGIS?

I've a PostGIS table polygon_b with some polygon features. There is also a table polygon_a which contains the same polygons as polygon_b but with minor changes. Now I want to create lines to visualize ...
8
votes
1answer
567 views

How to transform a set of street-segments into city-blocks, with PostGIS2?

Theoretically is possible to obtain the polygons of city blocks (urban blocks) from streets, when streets are represented by street axis (LineStrings). The urban blocks are bounded by streets, so ...
6
votes
3answers
2k views

Calculate distance between point and linestring and how to represent that on QGIS?

I have loaded my data with osm2pgrouting and I have my network with ways (Linestring) and nodes (Point). The problem is : I have a database of doctors addresses (point) and I should calculate the ...
7
votes
3answers
12k views

How to delete duplicate lines?

I was wondering if anyone could help. I have a tab file in MapInfo consisting of just polylines. Each is meant to have its own reference number, however some are duplicated (e.g two lines occupying ...
4
votes
1answer
2k views

how to split a line by a point which is on the line but not in the linestring itself?

i need some help with the following: i have a linestring - geom i have $lat,$lon (using some php syntax) i have an osm table with the roads geom, i am trying to get closest point, and then split the ...
3
votes
4answers
1k 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 ...
2
votes
1answer
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, ...
5
votes
1answer
539 views

r - sf::st_cast(“LINESTRING”) - keeping first linestring only warning

I have a dataset with geometry column in which there are linestrings and multilinestrings. While keeping the linestrings I want to convert the multilinestrings to linestrings (which should potentially ...
5
votes
3answers
8k views

Creating point to center of polyline?

I'm trying to create a points in the middle of polylines. The data is now in the form of shapefile. Is there an easy way to do this?
2
votes
1answer
896 views

Concatenating string with space

I am adding a number of strings together to create a linestring but as such I need spaces between the initial XY values and the end XY values, plus a comma in between the two halves. Should result in ...
7
votes
2answers
3k views

Split lines at intersection points

I've got some linestrings covering a road network, and need to split them at the crossroads. Does anybody have any idea on how to do it? I'm using QGIS 2.4, with a Postgis 2.1.3.
9
votes
2answers
3k views

How to add vertices to existing linestrings?

If I have Linestring(1 2, 1 5, 1 9) and a Point(1 3) Is there any function that can merge linestring and point preserving the order so output would be: Linestring(1 2, 1 3, 1 5, 1 9)
7
votes
1answer
4k views

Calculating length of just portion of linestring that intersect with polygon using PostGIS?

I want to calculate the portion of the linestring that lies within the limits of a polygon. Better with an image What is the length of the portion of linestring within Province A? and within Province ...
7
votes
3answers
1k views

How to generate geodesic linestring from two points in C#

I'm looking for a FREE C# class, library or set of functions that will allow me to generate a geodesic linestring (or array of vertices, whatever) from two decimal degree points. I've found ...
11
votes
2answers
4k views

How can I export a linestring to a GPX file in QGIS?

I have a linestring in a vector layer in QGIS. How can I expot/save this linestring as a GPX file? I tried to select the linestring, then right click on the vector layer and choose "Save selection as....
8
votes
1answer
9k views

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

I have a dataframe of X,Y coordinates that represent points along the paths taken by several different entities. Pseudo-data here, but it is roughly of the form: entity_id lat lon time 1001 ...
6
votes
1answer
799 views

Find all intersections of a LineString and a Polygon and the order in which it intersects it

I would like to find out all intersections of a LineString (River) through Polygons (Municipalities). I would like to list the order of municipalities which the river crosses, using linear referencing....
5
votes
3answers
3k views

Getting distance between two points over linestring using PostGIS?

I have a linestring: LINESTRING(-1.3326397 50.9174932,-1.3319842 50.9166939) and I select two points that lay on that linestring. How do I get the distance between these two points (in meters)?
3
votes
1answer
3k views

Get LineString length in meters (Python, GEODjango)

In a Django model, I have a LineString field which holds GPS coordinates of a street route. I know that I the .length holds the length of the LineString, but I don't know what unit the returned value ...
3
votes
2answers
1k views

Merging linestrings in QGIS using PostgreSQL and PostGIS

I've to merge all linestrings from a PostgreSQL table "river" where not more than two start-/endpoints are overlapping. In the illustration below I use a "M" to mark all linestrings that needs to be ...
8
votes
1answer
1k views

How to rank polylines according to their similarity to a ref polyline?

How to rank polylines according to their similarity to a ref polyline? Update 1: simulations show that simple $\sqrt{\sum{(case-ref)^2}}$ can find better similarity between polylines (as set of ...
3
votes
2answers
1k 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 ...
2
votes
1answer
1k views

Create a point in intersection of 2 lines postgis

As an ArcGIS user this is simple but in PostGIS has became a nightmare. But well I guess this is typical in beginners like me. I have 2 layers (multilinestring) called roads and waterways, I'm trying ...
2
votes
2answers
6k views

How to offset point perpendicular to line direction in PostGIS

I have a postgis table of points, that are sitting on road centerlines (I've linear referenced them). And the second table with road centerlines themselves. The point table also has a field roadid and ...
5
votes
1answer
1k views

Find the closest line vertex from the linestring using PostGIS

How to find the closest line vertex from a linestring? ST_ClosestPoint will give a point which is not from the linestring.
4
votes
1answer
52 views

QGIS Linestring rendering curves between vertex

I'm sure I hit a setting somewhere, but now I can't fix it. When a linestring shp file is rendered in QGIS it adds curves between my verticies... I want straight lines. How do I turn this off? In ...
3
votes
4answers
631 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 - ...
2
votes
1answer
3k views

How to find the intersection point of polygon geometry and multilinestring geometry in postgis

I have a polygon geometry and multilinestring geometry. How do i find the intersection of both these geometries. Both the geometries are in same reference system. Does st_intersection gives me the ...
2
votes
1answer
915 views

Add image along the LineString

I am wondering how to place images on a line. For example, instead of a dotted or dashed line. I could include a symbol of a cloud a character (e.g. |) repeated along the line. it cannot show the ...
2
votes
1answer
2k views

How do I extract points from a LineString or Polygon data frame and make a dictionary of point data frames?

I am building some pre-processing routines for 3D visualization of GIS data and I have several line and polygon shapefiles with multiple features. I want to extract the points for each of the features ...
2
votes
1answer
3k views

Merge multiple linestring features into a single multilinestring

Using QGis or ogr2ogr how do I convert a vector file containing multiple linestrings features into a single multilinestring feature? At the moment I've been doing this manually by converting the data ...
2
votes
1answer
1k views

MapServer: Symbol (v-line) style that automatically follows line direction

I created this image: with: MAP SIZE 1000 1000 IMAGETYPE png24 EXTENT -30 -10 60 30 UNITS DD SYMBOL NAME "v-line-shift" TYPE vector POINTS 0 0 5 10 10 0 END # POINTS ...
2
votes
3answers
648 views

How to break apart a complex line segment into simple line segments between all points?

Take for instance a very complex line string.. which has WKT like this LINESTRING(1 1,2 2,3 3,4 4,5 5 ...) I want to create two-point linestrings from many-point linestrings. SELECT ST_MakeLine(...
1
vote
1answer
627 views

QGIS show labels in beggining or ending points of Linestrings

I've got a Linestrings layer. Each Linestring has among other fields, these ones: id ENTRY EXIT 1 S1 E2 2 S1 E3 3 S1 E3 4 S1 E3 5 S1 E3 6 S1 E1 7 ...
1
vote
2answers
400 views

Frequency of partially or fully overlapping lines

Let L be a set of line-segments (lines) in a two-dimensional (2D) Euclidean space that are randomly (say, using uniform random function) distributed, that is, some may overlap other(s). Overlapping ...
0
votes
1answer
175 views

Can I use Point as the geom type in pgrouting?

in my table i have the field geom(POINT, srid) and its populated, this table also have the source an target field witch is blank(just like pgrouting guide). I tried the function pgr_createTopology() ...