22

There is now a plugin called QChainage that does exactly what you want. You specify an interval distance and the plugin creates points along your line at the specified interval.


20

In the Python console: you can use the Shapely module (as in How to create equidistant points in QGIS?) with the function point = line.interpolate(currentdistance) The new Python API of the master version (1.9) has an equivalent command (as in Generating chainage (distance) nodes in QGIS of Nathan Woodrow) point = geom.interpolate(currentdistance) or ...


14

You can use PyQGIS to measure the distances between all vertices of each polygon and find max: import itertools layer = iface.activeLayer() #Click layer in tree for feat in layer.getFeatures(): verts = [v for v in feat.geometry().vertices()] #List all vertices maxdistance = max([p1.distance(p2) for p1,p2 in itertools.combinations(verts, 2)]) #Find ...


14

You can achieve your goal using the Field Calculator. Using the Geometry Generator, with Linestring geometry type, use this expression collect_geometries( array_foreach( array_agg($geometry) ,make_line($geometry,@element)) ) It will create an array of lines that connect any point with all the others point on the same layer. You can create a new layer ...


13

Ah.. rookie mistake... The response included escaped backslashes facepalm. After removing those, it's all good.


12

I've written a script that changes the Sextante Densify geometries tool to accept a certain distance. It's called Densify geometries given an interval. After running Densify, you can extract the points using Extract nodes tool. You can get it from Github and install instructions are on my blog.


11

pyproj has the Geod.npts function that will return an array of points along the path. Note that it doesn't include the terminal points in the array, so you need to take them into account: import pyproj # calculate distance between points g = pyproj.Geod(ellps='WGS84') (az12, az21, dist) = g.inv(startlong, startlat, endlong, endlat) # calculate line string ...


11

Bear in mind that someone correctly pointed out very soon in comments that I had misread the question. My answer gives the diameter of the minimal circle but this does not always correspond to the longest distance between vertices in a polygon. As soon as more than 2 vertices touch the circle or if the vertices defining the circle are adjacent, the values ...


10

I assume you are wanting to join two line segments into one line. This is how I did it ... Enable editing. Turn on snapping ( Settings -> Snapping Options ... ) Select the node node tool. Double click close to the end of one of the lines to add a node. Drag the node at the end to snap onto the the end of the other line Select both lines Merge their ...


10

You can make use of the virtual layers. Go to Layer/ Add layer/ add-edit virtual layer and enter the following query. Feel free to add as many field as you want. The trick is to do a cross-join on the same table, generating every combination between the two layers. select a.id, b.id, makeline(a.geometry, b.geometry) as geometry from myLayer a, myLayer b ...


9

For anyone coming to this with newer versions of QGIS, the function to do it is now called "Collect Geometries" rather than "Single parts to Multipart" so it's now Vector > Geometry Tools > Collect Geometries. You can then choose a field (or fields) to use as your grouping variable (Unique ID Fields). I used it to fix up some statistical areas which included ...


9

You can use the arc.js plugin for leaflet to draw curved lines.


9

This should be possible without any plugin using the default Processing tools, particularly Distance to nearest hub: https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/qgis/vectoranalysis.html#qgisdistancetonearesthublinetohub


9

In QGIS, use "Geometry by Expression" tool (in a projected CRS). It will also add points information/attributes to polygons. Select "Polygon" as "Output geometry type" option. Add the following expression as "Geometry expression" value: make_square(make_point($x, $y), make_point($x+100, $y+100))


8

You can use the Create Grid tool for this task. Also the Clip tool can be useful for removing lines outside the polygon boundaries.


7

Following Nathan's answer, you can create a python action in the layer where you want to swap lines: layer = QgsMapLayerRegistry.instance().mapLayer("_your_layer_id_") r = QgsFeatureRequest([% $id %]) f = QgsFeature() if layer.getFeatures(r).nextFeature(f): geom = f.geometry().asPolyline() geom.reverse() geom = QgsGeometry.fromPolyline(geom) if ...


7

One approach is to convert this to raster and then extract contours Another is to find the buffer for each point;Dissolve those buffers to get a narrow polygon;Find the center line of each dissolved polygon.


7

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 only the edges you can uncheck all extra options. The result contains the common edges only once. With real data the result may not be perfect because adjacent ...


7

If you snap the point to the line then you can split the line and then extract the parts from the resulting collection. Use a really small tolerance, I don't know how small it needs to be... > site_snap = st_snap(site, reach, tol=1e-9) > parts = st_collection_extract(st_split(reach$geometry, site_snap$geometry),"LINESTRING") parts is now two features,...


7

Use the ogr2ogr utility with the ST_REVERSE function in a SQL statement and OGR SQLite dialect: For example: ogr2ogr -dialect SQLITE -sql "select st_reverse(GEOMETRY), * from input" output.shp input.shp Note: You need to pass in the st_reverse(GEOMETRY) first as the GEOMETRY field is automatically selected if the * wildcard is used and ogr will write only ...


7

When holes of the polygons have to be avoided So, this is an extension to my previous answer Calculating the longest distance within polygon in QGIS but with some changes in the Step 3, particularly in the query. SELECT p1.id, setsrid(make_line(p1.geometry, p2.geometry), #put your srid here), max(st_length(make_line(p1.geometry, p2.geometry))) AS ...


7

Using a Virtual layer, you can create a polygon of the desired dimension and move it to each location of the point layer. You can then save as the output if you want to persist the data. Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Replace the layer name for yours. WITH src AS ( SELECT ST_GeomFromText('...


7

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["geometry"] = f.geometry().asWkt() lyr.updateFeature(f)


6

This plugin reverses the line direction too: https://hub.qgis.org/projects/swapvectordirection You have to select a feature, and turn the layer into edit mode before clicking on the plugin icon.


6

There is this QGIS plugin which says it does exactly what you want. https://plugins.qgis.org/plugins/joinmultiplelines/ https://github.com/dgoedkoop/joinmultiplelines (However, I was not able to use it correctly in QGIS 2.6)


6

I would create a geometry collection from the points using st_collect(): http://postgis.net/docs/ST_Collect.html Then I would create convex hull from the point collection: http://postgis.net/docs/ST_ConcaveHull.html If you have a table of point geometries called testpoints where geometry column name was the_geom, this should create the polygon that you are ...


6

Drag&Drop your CSV-file into QGIS, so you can see it in Layers tab Use a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... with the following query SELECT make_line(setsrid(make_point(start_easting, start_northing),27700), setsrid(make_point(end_easting, end_northing),27700) ) AS geom FROM &...


5

Considering IE8 support requirement, we don't have many options on the table. I can only recall one SVG lib that has VML fallback — Raphaël.js So you can try this Raphaël layer plugin implementation for Leaflet. https://github.com/dynmeth/RaphaelLayer I didn't try plugin myself, but successfully used Raphaël. Hope you can find a use of it. Here is the ...


5

Based on Nathan's post I've created a processing script to reverse the direction of features: #!/usr/bin/env python # -*- coding: utf-8 -*- # define Interface ##QGIS tools (QGIS 2.x)=group ##Reverse vector direction=name ##Input_layer=vector ##Only_selected_features=boolean true from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4 import * ...


5

I don't know of any built-in tools that track the length of lines as you are editing. Assuming you are already Editing a layer, one work-around would be (in qGIS 2.0.x): Open the Layer's Attribute Table. Open the Field Calculator (Ctrl-I) Create a new field, name it something like "Length", set the type to decimal width 18, precision 10, or ...


Only top voted, non community-wiki answers of a minimum length are eligible