Distance between point and boundary

654 views
Skip to first unread message

Gareth

unread,
Oct 31, 2008, 5:36:09 AM10/31/08
to MapInfo-L
Hi all!
I've got something to so where i need to calculate the distance
between a point and closest part of a polygon which it is in. Has
anyone got any ideas how i could go about doing this. I need to do it
for whole table so some kind of sql may be needed..
Thanks,
Gareth

Gareth

unread,
Oct 31, 2008, 6:15:04 AM10/31/08
to MapInfo-L
I actually want to change this :) It might make it harder though..
Basically, can I calculate the distance between a point, and the
centroid of the polygon that it's within..

I've been looking at the distance calculator etc but cant seem to find
exactly how to do it.
Thanks,
Gareth

Driver, Greg 9434

unread,
Oct 31, 2008, 6:57:04 AM10/31/08
to mapi...@googlegroups.com
Gareth,

Actually, this makes it easier! You should be able to do an SQL select based on a 'point within polygon' spatial query and use the Distance() function, along with CentroidX() & CentroidY(,) to return the distance between the point and centroid of the polygon:

Select distance(centroidx(point_obj), centroidy(point.obj), centroidx(poly.obj) centroidy(poly.obj), "mi")
from point, poly where point within poly

HTH

Greg Driver

System Administrator
Applications Support
ICT
Surrey Police
NOT PROTECTIVELY MARKED
*Internet communications are not secure and therefore Surrey Police does not accept legal responsibility for the contents of this message. This email and any attachments may be confidential. They may contain privileged information and are intended for the named addressee (s) only. They must not be distributed without our consent. If you are not the intended recipient, please notify us immediately and delete the message and any attachments from your computer, do not disclose, distribute, or retain this email or any part of it. Unless expressly stated, opinions in this email are those of the individual sender, and not of Surrey Police. We believe but do not warrant that this e-mail and any attachments are virus free. You must therefore take full responsibility for virus checking. Surrey Police reserves the right to monitor all email communications through their networks.*

Peter Horsbøll Møller

unread,
Nov 2, 2008, 9:35:18 AM11/2/08
to mapi...@googlegroups.com
I would say that the Nearest statement added to one of the later versions of Pro would solve your problem.
 
Nearest [ N | All ]
From { Table fromtable | Variable fromvar }
To totable Into intotable
[ Type { Spherical | Cartesian }]
[ Ignore [ Contains ] [ Min min_value ] [ Max max_value ]
Units unitname ] [ Data clause ]
 
Peter Horsbøll Møller
 
Reply all
Reply to author
Forward
0 new messages