Thanks for that link.  That's the direction I'm headed.

I posted here to find out if this is an error in the python implementation or documentation and see if I should submit an issue.

*Worth Lutz*


On 5/6/2016 8:15 AM, Caio Hamamura wrote:
I've already used this function and it returned exactly the same you claim to receive. But you can calculate the position yourself, it is actually simple. Check it out:

http://stackoverflow.com/a/1560510/2548351



2016-05-05 13:25 GMT-03:00 Worth Lutz <[email protected] <mailto:[email protected]>>:

    I'm trying to use "closestSegmentWithContext" method of
    QgsGeometry in a plugin. I don't seem to be getting what I'm
    expecting.

    Comparing
    http://qgis.org/api/classQgsGeometry.html#ac09505a6a8a29f244a37c6f336cd98e7

    with the following from:
    
https://github.com/qgis/QGIS/blob/master/python/core/geometry/qgsgeometry.sip

        /**
         * Searches for the closest segment of geometry to the given point
         * @param point Specifies the point for search
         * @param minDistPoint Receives the nearest point on the segment
         * @param afterVertex Receives index of the vertex after the
    closest segment. The vertex
         * before the closest segment is always afterVertex - 1
         * @param leftOf Out: Returns if the point lies on the left of
    right side of the segment ( < 0 means left, > 0 means right )
         * @param epsilon epsilon for segment snapping (added in 1.8)
         * @return The squared cartesian distance is also returned in
    sqrDist, negative number on error
         */
        double closestSegmentWithContext( const QgsPoint& point,
    QgsPoint& minDistPoint /Out/, int& afterVertex /Out/ ) const;


    When I try:

        results =
        self.selectedStreetSegment.geometry().closestSegmentWithContext(point)


    I get a results as:

        (2560.365846544, (2106395, 746610), 1)

    I take this to be (sqrDist, minDistPoint, afterVertex ). It does
    not seem to be returning "leftOf" which is the value I'm looking for.

    Is something missing in that "sip" definition?  I do not know what
    I'm looking at so I may be looking at the wrong thing. In any
    case, I cannot seem to find the results I need.

    Thanks,
    --
    *Worth Lutz*



    _______________________________________________
    Qgis-developer mailing list
    [email protected] <mailto:[email protected]>
    List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
    Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer



_______________________________________________
Qgis-developer mailing list
[email protected]
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to