[QGIS-Developer] Interrogation about algorithms to offset/translate features

Paolo Cavallini cavallini at faunalia.it
Tue Aug 21 05:25:09 PDT 2018

Hi all,

On 08/21/2018 07:09 AM, Nyall Dawson wrote:
> On Mon, 20 Aug 2018 at 23:17, DelazJ <delazj at gmail.com> wrote:
>> Good day devs,
>> Today I was looking for an algorithm to create parallel lines in another layer and a search provides me with many candidates. I found
>> - "translate": creates one parallel feature moved at a specified x/y/z/m offset distance
>> - "array of offset features": same thing than translate but generating the parallel of the parallels up to the specified number of copies
>> - "offset lines": applies an offset to the features (from what I see, it's an homothetic operation), generating one feature that is not a copy of the previous (not the same length, if multiline eg)
>> - "create parallel lines": same as  the offset lines tool but generating multiple offsets.
>> I have some concerns/questions:
>> -"translate" vs "array of offset features": why not just add the "number of features to create" parameter to the translate algorithm instead of having created a new one?
>> - "offset lines" vs "create parallel lines": same question as above, in favor of the offset lines algorithm
> My personal preference is to keep individual algorithms as simple as
> possible, and have additional algorithms covering similar use cases. I
> prefer this over the GRASS/SAGA algorithm approach of having one
> algorithm with a multitude of parameters which interact in different
> ways. In this case the algorithms have been separated into "vector
> creation" algorithms (array of offset features, create parallel lines)
> vs "geometry modification" algorithms (translate, offset lines).

Fully agreed. The original grass plugin had this approach, and it worked
very well IMHO in most cases.
There are a few algs who cannot be easily made atomic without creating a
messy set of very similar commands, but that's the exception rather than
the rule.
>> with less algs, there will be less translation to do and I hope less confusion around this concept.
> ...but I'm a strong -1 to squashing these operations into the same algorithm.
again, fully agreed
All the best.

Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html

More information about the QGIS-Developer mailing list