[QGIS-Developer] closestSegmentWithContext() with epsilon in Python

Radim Blazek radim.blazek at gmail.com
Fri Nov 24 06:38:20 PST 2017


It looks like this:

#ifndef SIP_RUN
    double closestSegmentWithContext( const QgsPointXY &point,
QgsPointXY &minDistPoint, int &afterVertex, double *leftOf = nullptr,
double epsilon = DEFAULT_SEGMENT_EPSILON ) const;
#else
    double closestSegmentWithContext( const QgsPointXY &point,
QgsPointXY &minDistPoint SIP_OUT, int &afterVertex SIP_OUT ) const;
#endif

maybe trivial for who knows how to do it, that is why I asked. How to
skip leftOf and make epsilon keyword argument?

Radim

On Fri, Nov 24, 2017 at 1:16 PM, Matthias Kuhn <matthias at opengis.ch> wrote:
> Hi Radim,
>
> I don't know why the epsilon is excluded from the python bindings, the
> docs say nothing.
> Adjusting it should be trivial, just edit qgsgeometry.h (the
> prepare-commit script will do the heavy lifting)
>
> Matthias
>
> On 11/24/2017 12:58 PM, Radim Blazek wrote:
>> Hi,
>>
>> I found that closestSegmentWithContext() in Python is useless for
>> geometries in geographic crs, because small squared distances are set
>> to zero because of epsilon threshold. See for example:
>> https://user-images.githubusercontent.com/29453443/32953189-c395d8a0-cbaf-11e7-8d71-b5869392f08b.PNG
>> points are not assigned to lines correctly because square distances are wrong.
>>
>> Would it be possible to add epsilon as keyword argument to
>> closestSegmentWithContext() and possibly other methods taking epsilon
>> in C++?
>>
>> I am not sip/python expert, no idea how to do that.
>>
>> Thanks
>> Radim
>> _______________________________________________
>> 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
>>
> _______________________________________________
> 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