Hallo

What you do is htat you use the linestrings defining the polygons instead of the polygon instead in the ST_Dwithin statement.

Then you can also us ST_Closestpoint to find a line between the point and the closest point on the edge. This line can you use in ST_Azimuth.

If your polygons have inner rings you can use ST_DumpRings to take also those in account. If you only want to use the exterior rings you can omit that part. But if there is multipolygons, you should use ST_Dump instead just to get single polygons.



SELECT ST_Azimuth(point_table.the_geom, ST_ClosestPoint(edges.the_geom, point_table.the_geom)) as the_azimuth FROM (SELECT ST_ExteriorRing((ST_DumpRings(the_geom)).geom) as the_geom FROM polygons_table) edges
, point_table
WHERE ST_DWithin(edges.the_geom, point_table.the_geom, 10000);


HTH

Nicklas










On 02/16/2012 04:53 PM, uk52rob wrote:

Hi,

I need to create a WHERE statement which is true if a point is within 10000 metres of the closest edge of a polygon (EPSG:27700).

I have this working fine for point to point queries, but I am struggling with point to polygon. I also need to perform ST_Azimuth on the resulting data to return a bearing.

Has anyone got any ideas?

Thanks



_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to