Geographic Information Systems Asked by maxwellhertz on July 18, 2021
ArcGIS Enterprise SDK has something like this:
public void QueryTangent (
esriSegmentExtension extension,
double DistanceAlongCurve,
bool asRatio,
double Length,
ILine tangent
);
Given a distance along the curve specified either as a ratio of the length or as a specific fixed distance, QueryTangent returns the Line tangent to the Point.
I wonder if anything like this exists in QGIS Python API? If not, is it possible to implement this function from scratch?
Looks like it doesn't exist. But you can implement it. Combinig QgsGeometry and QgsGeometryUtils methods may help.
To begin with, I would examine interpolatePointOnLine
, interpolatePointOnLineByValue
, linePerpendicularAngle
, perpendicularSegment
, pointOnLineWithDistance
methods.
Answered by Kadir Şahbaz on July 18, 2021
As @Kadir Şahbaz mentioned it, there is no direct ways to calculate a tangent line to a curve using PyQGIS API. However, there is a workaround to my problem:
p
lying on a curve c
;QgsGeometryUtils.pointOnLineWithDistance
to get anther point q
that is very close to p
on c
;p
with q
, then we have a line approximately tangent to p
.Answered by maxwellhertz on July 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP