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

Nyall Dawson nyall.dawson at gmail.com
Mon Aug 20 22:09:18 PDT 2018


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).

There's also the consideration that the vector creation algorithms
also include the original feature by design - if you wanted to do this
same thing by adding a "number of features" to the translate/offset
lines algorithm, then you'd either need to add *another* parameter for
"include original feature" OR require users to do some manual feature
copy/pasting to append the original feature to the new table. Neither
option is desirable in my view.

> - I'm pretty lost with the use of the word "offset" in those algs. I don't know what it really implies in English but my understanding was more of a translation than a homothety. It tooks me some time to sort out the above explanation of the algorithms behavior:

In general we've been trying to re-use PostGIS terminology for
algorithms and expression functions. So "offset lines" algorithm =
"offset_curve" expression function = ST_OffsetCurve PostGIS function.
(so there's a bit of an issue here - the processing algorithm should
be renamed "offset curves"... although that name would be a bit
misleading, because the algorithm doesn't handle curved geometry types
and forces everything to linear segments. But then, so does the
offset_curve expression function and PostGIS' ST_OffsetCurve. Wooo!).

>   - Would that be possible to review the description and insert this homothetic idea so that people understand clearly that one do copy the same features and the other one may be different?

Improving the algorithm's tags/short description/short help would
always be appreciated!

> 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.

>   - and I still wonder if "create parallel lines" and "array of offset features" are not inverted names: in my mind, "array of offset features" sounds closer to "offset lines" than to "translate" which in turn is looks closer to "create parallel lines".

I dislike the name "array of offset features", but it was the best one
Mathieu and I could think of. Maybe it should be "array of translated
features"/"array of offset lines"? I'd be happy to accept a PR giving
them better names!

> - what about allowing polygons for the currently called "offset lines" and "create parallel lines" algs?

Isn't that basically the same as buffer/multi-ring buffer (followed by
taking the boundary of the result).

Nyall

>
> Regards,
> Harrissou
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list