The following SQL uses ST_Geometry to return a resultset of 10 records, ordered by distance from a fixed location (a point geometry) to the nearest point of the polygon. How do I get the coordinates of the nearest point on the polygon? For example, if a record shows up in the resultset and the distance is 100, I want to see the coordinates of the point 100 meters from my fixed location.

    SELECT areas.XYZ, sde.st_distance(sites.shape,areas.shape)
    FROM ABC.site sites, XYZ.identifiedarea areas
    WHERE sites.id = 123
    AND sde.st_intersects(areas.shape, sde.st_buffer(sites.shape, 1000)) = 1
    ORDER BY sde.st_distance(sites.shape,areas.shape)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.