# Distance between two points

6 posts, 1 answers
1. ##### Carlos Rodriguez
72 posts
Member since:
Aug 2009

Posted 08 Apr 2010 Link to this post

You can get the ditancia between two points on the map? No matter if it is not accurate, albeit approximate.
2. Answer
##### Andrey
Admin
1681 posts

Posted 09 Apr 2010 Link to this post

Hi Carlos,

You can use LocationRect object for this purpose:
`Location location1 = ``new` `Location(37.7040701207995, -121.882780875908); `
`Location location2 = ``new` `Location(37.7140701207995, -121.872780875908); `
` `
`Location northEast = ``new` `Location( `
`    ``Math.Max(location1.Latitude, location2.Latitude), `
`    ``Math.Max(location2.Longitude, location2.Longitude)); `
` `
`Location southWest = ``new` `Location( `
`    ``Math.Min(location1.Latitude, location2.Latitude), `
`    ``Math.Min(location1.Longitude, location2.Longitude)); `
` `
`LocationRect rect = ``new` `LocationRect(northEast, southWest); `
`rect.MapControl = ``this``.radMap; `
` `
`double` `distance = Math.Sqrt(rect.Width * rect.Width + rect.Height * rect.Height); `

Sincerely yours,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
3. ##### Carlos Rodriguez
72 posts
Member since:
Aug 2009

Posted 09 Apr 2010 Link to this post

It's pretty simple!

thank you very much Andrey!
4. ##### Carlos Rodriguez
72 posts
Member since:
Aug 2009

Posted 15 Apr 2010 Link to this post

```I Have problems in this line: LocationRect rect = ````new` ```LocationRect(northEast, southWest); I get the following manner: LocationRect rect = newLocationRect(northEast, southWert, With, Height),I can do in this case? ```
5. ##### Carlos Rodriguez
72 posts
Member since:
Aug 2009

Posted 15 Apr 2010 Link to this post

6. ##### Andrey
Admin
1681 posts

Posted 16 Apr 2010 Link to this post

Hi Carlos Rodriguez,

It seems you are using quite old CTP version of the RadMap control. Since first official release of the RadMap in 2010.Q1 the LocationRect class has 2 constructors:

1. LocationRect(double north, double west, double width, double height)
2. LocationRect(Location northEast, Location southWest)

In order to get distance between 2 geographical locations you must use second type of the constructor. It creates rectangle using geographical locations. You can't use the first type of the constructor for this purpose.

Sincerely yours,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.