Esri / spatial-framework-for-hadoop

The Spatial Framework for Hadoop allows developers and data scientists to use the Hadoop data processing system for spatial data analysis.
Apache License 2.0
363 stars 160 forks source link

One problem about how to compute the distance from point to polygon boundary when point in polygon #125

Closed hengshan123 closed 6 years ago

hengshan123 commented 7 years ago

I want to compute the distance from point to polygon boundary when this point in polygon. This task need compute the distance from point to line ,or linestring. I find a method to do this. First use ST_ExteriorRing get the linestring of polygon. but i need remove one point, so the linestring is not a polygon anymore. then compute two times of point to linestring , and find the smaller distance . it will be the smallest distance of point to polygon when point in polygon.

I need a method to remove one point of a polygon's linestring. Could someone tell me how to do this? i will be very appreciated!

randallwhitman commented 7 years ago

Not understanding what would be missing from simply: select ST_Distance(ST_ExteriorRing(ST_Polygon(-1,-1, 1,-1, 1,1, -1,1)), ST_Point(0.2,0.5));