# Knowing how point is far from a route

**URL:** <https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497>\
**Category:** Routing\
**Created:** [October 11, 2009, 12:46pm UTC](https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497 "2009-10-11T12:46:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ahmed/32/24995_2.png) [@Ahmed](https://community.thinkgeo.com/u/Ahmed)\
**Post date:** [October 11, 2009, 12:46pm UTC](https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497/1 "2009-10-11T12:46:27Z")

</div>

dear&nbsp;sir,

&nbsp;

if&nbsp;i&nbsp;have&nbsp;route&nbsp;(r)&nbsp;between&nbsp;p1&nbsp;and&nbsp;p2,&nbsp;and&nbsp;i&nbsp;have&nbsp;another&nbsp;point&nbsp;p3&nbsp;outside&nbsp;the&nbsp;route&nbsp;and&nbsp;i&nbsp;want&nbsp;to&nbsp;know&nbsp;how&nbsp;far&nbsp;is&nbsp;this&nbsp;point&nbsp;form&nbsp;nearset&nbsp;point&nbsp;of&nbsp;route.&nbsp;how&nbsp;can&nbsp;i&nbsp;do&nbsp;this&nbsp;?

&nbsp;

thanks,

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [October 11, 2009, 8:50pm UTC](https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497/2 "2009-10-11T20:50:37Z")

</div>

&nbsp;

Ahmed,  
&nbsp;  
MapSuite&nbsp;Routing&nbsp;is&nbsp;based&nbsp;on&nbsp;MapSuite&nbsp;Core,&nbsp;so&nbsp;you&nbsp;can&nbsp;use&nbsp;the&nbsp;code&nbsp;blow&nbsp;to&nbsp;calculate&nbsp;the&nbsp;shortest&nbsp;distance:  
&nbsp;  
`MultilineShape router = routingEngine.GetRoute(point1, point2).Route;PointShape point3 = new PointShape(-97.739599613769542, 30.277963047607429); MultilineShape shortestLine = point3.GetShortestLineTo(router, GeographyUnit.DecimalDegree); double shortestDistance = shortestLine.GetLength(GeographyUnit.DecimalDegree,DistanceUnit.Kilometer); `  
&nbsp;  
Another&nbsp;way&nbsp;is&nbsp;that&nbsp;you&nbsp;can&nbsp;generate&nbsp;the&nbsp;nearest&nbsp;point&nbsp;of&nbsp;route&nbsp;from&nbsp;p3,&nbsp;and&nbsp;then&nbsp;calculate&nbsp;the&nbsp;distance&nbsp;between&nbsp;them:  
  
&nbsp;  
`PointShape closestPoint = router.GetClosestPointTo(point3, GeographyUnit.DecimalDegree); double shortestDistance = closestPoint.GetDistanceTo(point3, GeographyUnit.DecimalDegree,DistanceUnit.Kilometer); `  
&nbsp;  
  
&nbsp;Any&nbsp;questions&nbsp;or&nbsp;comments&nbsp;please&nbsp;let&nbsp;us&nbsp;know!  
Thanks!  
&nbsp;  
Johnny

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ahmed](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ahmed/32/24995_2.png) [@Ahmed](https://community.thinkgeo.com/u/Ahmed)\
**Post date:** [October 12, 2009, 7:32am UTC](https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497/3 "2009-10-12T07:32:21Z")

</div>

it&nbsp;is&nbsp;working&nbsp;now,&nbsp;thanks.

---

<div class="post-metadata">

**Author:** ![Johnny](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/johnny/32/19044_2.png) [@Johnny](https://community.thinkgeo.com/u/Johnny)\
**Post date:** [October 12, 2009, 8:20pm UTC](https://community.thinkgeo.com/t/knowing-how-point-is-far-from-a-route/7497/4 "2009-10-12T20:20:48Z")

</div>

You&nbsp;are&nbsp;so&nbsp;welcome!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks!&nbsp;  
&nbsp;&nbsp;  
&nbsp;Johnny
