Skip to main content
34 votes
Accepted

Creating buffer circle x kilometers from point using Python?

Use a spatial projection library to do the hard work. Adapting from a previous answer, use a dynamic azimuthal equidistant projection to do a geodesic buffer. Updated solution with PyProj 2.1+ from ...
Mike T's user avatar
  • 42.2k
17 votes
Accepted

Finding algorithms of QGIS commands?

The "minimum bounding geometry" and "clip polygon" algorithms in QGIS are implemented in /python/plugins/processing/algs/qgis/MinimumBoundingGeometry.py and /src/analysis/processing/qgsalgorithmclip....
Candy Gumdrop's user avatar
14 votes
Accepted

Seeking Algorithm to detect circling and beginning and end of circle?

I couldn't stop thinking about this... I was able to come up with a Stored Procedure to do the loop counting. The example path contains 109 loops! Here are the flight points shown with the loop ...
kttii's user avatar
  • 3,630
14 votes
Accepted

Investigating PostGIS functions to see what they are doing?

Not sure if this is helpful, let's go down the rabbit hole. First we need to know what's happening when you call the function in SQL. To do this we reference the output of \dS+. \dS+ shows the ...
Evan Carroll's user avatar
  • 7,091
14 votes
Accepted

Listing multiple fields to be dropped at once in QGIS modeler?

You need to separate them via semi-colons: field1;field2;field3
ndawson's user avatar
  • 27.7k
13 votes

Detecting branched polygon shape?

You could have a look at the following method : skeletonize your polygons and rather work on line type features related to your original polygon with a unique source polygon ID. I guess there's some ...
gisnside's user avatar
  • 7,858
12 votes
Accepted

Get progression bar into PyQGIS 3 standalone script

Yes - processing.run accepts a "feedback" argument, which must be an instance of a QgsProcessingFeedback subclass. If you construct your own feedback object to pass to this function, you can connect ...
ndawson's user avatar
  • 27.7k
11 votes
Accepted

Clustering undirected lines

If I understand you right you want to cluster lines that is about the same without respect to direction. Here is an idea that I think could work. split the lines in start point and end point Cluster ...
Nicklas Avén's user avatar
10 votes
Accepted

Is there an optimal algorithm to find the longest shortest path in a network?

I think you may be looking for the Graph Diameter of your network. There are a couple of questions on stackexchange that mention this topic, e.g.: The time complexity of finding the diameter of a ...
mkadunc's user avatar
  • 2,071
9 votes

What are Definition, Algorithms and Practical Solutions for Concave Hull?

QGIS does have Concave hull algorithm. Parameters Input point layer [vector: point] put parameter description here Threshold (0-1, where 1 is equivalent with Convex Hull) [number] put parameter ...
whyzar's user avatar
  • 12.1k
8 votes

Generalization algorithms

You can have a look at the following python versions of those algorithms: Visvalingam–Whyatt Reumann–Witkam Opheim simplification Lang simplification Couldn't find an example for Zhao-Saalfeld (yet)....
Joseph's user avatar
  • 76k
8 votes

Is there an optimal algorithm to find the longest shortest path in a network?

According to the Wikipedia page Longest path problem, this problem ... is NP-hard, meaning that it cannot be solved in polynomial time for arbitrary graphs unless P = NP. Stronger hardness ...
Alex Tereshenkov's user avatar
8 votes
Accepted

Creating line between two points with same value using QGIS?

On the sensor layer, go to symbology and change the symbol to a "Geometry Generator". Choose "Line" as type. Enter the following expression make_line( -- the current feature's geometry (point from ...
Matthias Kuhn's user avatar
8 votes

QGIS algorithm to copy vector layer with only selected fields

The export / save layer as dialog provides a list of fields where users can chose which fields should be included in the export. To reproduce this in a Processing model, you can use the "Drop ...
underdark's user avatar
  • 84.3k
7 votes
Accepted

Finding Similar Map Paths

Map matching is different from what you are looking for. Map matching is the proper way of matching an erroneous GPS observation to the linear street network. Your question has nothing to do with GPS ...
Farid Cheraghi's user avatar
7 votes
Accepted

Let QGIS 3.0 Processing algorithm output a VectorLayer loaded via the delimited text provider

Because your output here is effectively hard-coded, you don't need to define it as a input parameter. Instead declare it as an output that your algorithm generates: self.addOutput( ...
ndawson's user avatar
  • 27.7k
7 votes
Accepted

PyQGIS Processing: "memory: not found"

The grass provider does not support QGIS memory layers, so you'll need to give it a path to a real location it can store the temporary result as.
ndawson's user avatar
  • 27.7k
7 votes
Accepted

What is the algorithm that Shapely used to check if two polygons intersect?

A quick search of the Shapely code base leads to impl.py which: """Implementation of the intermediary layer between Shapely and GEOS This is layer number 2 from the list below. ...
Ian Turton's user avatar
  • 82.2k
7 votes

What is algorithm name for "Count Points in Polygon" using PyQGIS?

In case you do not know a name or id, you can use: searchstring = 'count' # to get all algorithms just leave this empty for alg in QgsApplication.processingRegistry().algorithms(): if searchstring ...
MrXsquared's user avatar
  • 34.9k
6 votes

Free implementation of Polynomial Approximation with Exponential Kernel (PAEK) algorithm

I came across a thread Smoothing a 2-D figure. The answers make reference to this paper Chaikin's algorithm for curves For a given polygon with vertices as P0, P1, ...P(N-1), the corner cutting ...
whyzar's user avatar
  • 12.1k
6 votes

How to find the concave hull for a cloud of points in 3D space?

A convex hull is unique, whereas there are many possible concave hulls. So you cannot say "the concave hull" but "a concave hull". There is possibly a minimal volume concave hull, but this is not the ...
galinette's user avatar
  • 161
6 votes

Clustering undirected lines

Do you really want to cluster solely by direction, without any consideration of origin or destination? If so, there are some very simple ways. Perhaps the easiest is to compute the bearing of each ...
whuber's user avatar
  • 69.9k
6 votes
Accepted

Calculating the earth radius at latitude

You made an error in the line defining the radius in your function. Instead of f3 / f4 it should be f3 + f4. The corrected line should be as follows - var radius = Math.sqrt((f1 + f2) / (f3 + f4)); ...
nash's user avatar
  • 1,986
6 votes
Accepted

How to use a Processing Algorithm in a expression function used in a Geometry Generator (Points Along Lines "on the fly")

You can use the following expression to create the points along the line every n distance (here 5000 considering the layer use meters) collect_geometries(array_foreach( generate_series(0, length($...
ThomasG77's user avatar
  • 31k
6 votes
Accepted

What is algorithm name for "Count Points in Polygon" using PyQGIS?

It is "native:countpointsinpolygon". I usually execute the tools manually in QGIS then Ctrl+Alt+H to copy paste the syntax to use in PyQGIS.
Bera's user avatar
  • 74.8k
6 votes

Detecting and making all connected lines in the same direction in QGIS

Compare the azimuth of each line to the line group mean, and reverse the line in each group that deviate the most from the group mean: Refactor fields (or use two field calculators) to calculate: ...
Bera's user avatar
  • 74.8k
6 votes
Accepted

Algorithms for finding nearest road

You can use Hausdorff distance: Two sets are close in the Hausdorff distance if every point of either set is close to some point of the other set. Here I cross join the table to itself to compare ...
Bera's user avatar
  • 74.8k
6 votes
Accepted

Using Conditional branch algorithm in QGIS Graphical Modeller

I've created a model with an input point layer. A conditional branch with two conditions: If there is an A in the art column: The points get buffered If not it will create rectangles around the ...
Bera's user avatar
  • 74.8k
5 votes
Accepted

Understanding Contraction Hierarchies

As mentioned on the web page, any order will work, in the sense that the query will find a shortest path. However some orders are much better than others in terms of the time taken to preprocess the ...
Sabri's user avatar
  • 66
5 votes

Finding algorithms of QGIS commands?

You can check the algorithms at QGIS Github and find scripts for all the tools such as the minimum bounding geometry.
Joseph's user avatar
  • 76k

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