31 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. from functools import partial import ...
user avatar
  • 39.9k
20 votes

Creating "average" polygon?

I've figured out an algorithm for the grid approach using several Python tools. Rasterising and polygonising is done with rasterio, which is based on GDAL/OGR. Here are most of the imports: import ...
user avatar
  • 39.9k
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....
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 ...
user avatar
  • 3,520
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
user avatar
  • 26.3k
13 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 ...
user avatar
  • 6,701
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 ...
user avatar
  • 7,508
13 votes
Accepted

Running PyQGIS algorithm on selected features in layer

you need add the layer to project. For add without showing it use: QgsProject.instance().addMapLayer(layer1, False) Example using only one layer: layer1 = QgsVectorLayer(r"C:\test\grassland.shp", '...
user avatar
  • 7,225
12 votes

Finding minimum-area-rectangle for given points?

I just implemented this myself and posted my answer over on StackOverflow, but I figured I'd drop my version here for others to view: import numpy as np from scipy.spatial import ConvexHull def ...
user avatar
12 votes
Accepted

How do the equations/algorithms behind buffering tools actually work?

If you are interested in an implementation look at jsts a Javascript implementation of the much used Java Topology Suite library -- depending on whether you prefer reading Javascript or Java, I ...
user avatar
  • 13.2k
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 ...
user avatar
11 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 ...
user avatar
  • 26.3k
9 votes

Calculating grid convergence (True North to Grid North)

The formula for calculating grid convergence (sometimes called meridian convergence) for spherical UTM projections was given (very incorrectly until just now) at How to Calculate North? In case that ...
user avatar
  • 8,604
8 votes

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

To add to previous answers for this post, at least as of QGIS 2.6 does have concave hull algorithm Parameters Input point layer [vector: point] put parameter description here ...
user avatar
  • 11.9k
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)....
user avatar
  • 72.3k
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 ...
user avatar
8 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 ...
user avatar
  • 1,961
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 ...
user avatar
  • 82.1k
7 votes

Dividing polygon into specific sizes using ArcGIS Desktop?

There is a ready-made tool called ET Spatial's "GeoTools". Where there is a tool called "ET Miscellaneous". In this tool there are two types of way to split polygons viz. By Percentage and By Area ( ...
user avatar
  • 3,456
7 votes

Interpolate data from multiple gpx tracks

Yes, there are such algorithms (see for example here, there and here) but since you seem to have only one single road, would it not be easier to do it by hand? (!). Using for example QGIS, you could ...
user avatar
  • 9,947
7 votes

Fast raster combine using rasterio

Looking over your code, I don't see how it will be faster than pure Python. It's exclusively calling Python methods (rasterio methods, np.dstack is Python) and those aren't executed any faster just ...
user avatar
  • 8,538
7 votes

Finding the Center Line from a set of 3D Points

There is a paper called "Curved Reconstruction from Unorganized Points" by In-Kwon Lee which looks into constructing lines/curves from a set of points without any ordering by exploiting the moving ...
user avatar
  • 72.3k
7 votes

Project location on a (great circle) path

Using a spherical model of the earth may give adequate accuracy and leads to simple fast calculations. Convert all coordinates into earth-centered (3D) cartesian coordinates. For example, the ...
user avatar
  • 67.6k
7 votes
Accepted

Does this ArcGIS flow accumulation example have an error?

It is an error. Your link and presumably image source is the 10.0 help. The error is still present in the 10.1 help. However in the 10.2 help, it has been corrected to show only a 1. It's also worth ...
user avatar
  • 15.5k
7 votes

Minimising number of dynamic pages to map scattered points using ArcGIS Desktop?

This is not the answer, I just thought I post Python solution for those who interested: # --------------------------------------------------------------------------- # PAGE MAKER # # ----------------...
user avatar
  • 21.6k
7 votes

What algorithm does QGIS use to calculate Nearest Neighbor Index?

You can check the source code for the Nearest Neighbour Analysis tool from GitHub. More specifically, the following lines of code which shows how the different parameters are calculated: do = float(...
user avatar
  • 72.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 ...
user avatar
7 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 ...
user avatar
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.
user avatar
  • 26.3k
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 ...
user avatar
  • 25.6k

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