CartoDB (PostGIS) near function (distance) points to polygons

المشرف العام

Administrator
طاقم الإدارة
I have a CartoDB map here:

Link: https://dms2203.cartodb.com/viz/78db6c02-3148-11e5-a42f-0e018d66dc29/public_map

I'm trying to find the distance of the points to the polygon. If the points are inside, they should have a value of 0. Basically, I'm looking for Near (Analysis) from ArcGIS equiv. in PostGIS http://resources.arcgis.com/en/help/main/10.1/index.html#//00080000001q000000

Could someone help me craft out the SQL? I'm trying to learn to do it in PostGIS but figure it's easier to test out the SQL statement in CartoDB.

I've referred to this: http://postgis.net/docs/ST_Distance.html but have had trouble with the syntax on my end.

The points are in a layer called:points_near

The polygon is in a layer called:polygon_near

Thanks!



أكثر...
 
أعلى