Estimated travel time using dbgeography

Asked

Viewed 70 times

2

It is possible to calculate the estimated travel time between two localities using dbgeography in C#?

  • Welcome Sopt, Have you ever tried to do something? post the code to take a look.

  • Only approximate because the distance given by the Distance method of dbGeography will be a straight line.

  • Guilherme only has the database with dbgeography.

  • You need to have another basis with the map and information on how to go through the stretches of the map and the routine to go through the stretches and know the distance following the streets and roads.

1 answer

2


Depends!

The class Dbgeographyc not made for it. It allows you to work with dots or shapes (polygons/shapes).

The only way to calculate the time between two points is by knowing how far you can travel in so long.

You may ask: How so?

I’ll explain.

With the Dbgeographyc you can only get the distance between two points (usually in meters), for example:

var pointA = string.Format("POINT({1} {0})", latitude1, longitude1);  
var pointB = string.Format("POINT({1} {0})", latitude2, longitude2);

var distanceInMeters = pointA.Distance(pointB);  

Point To to the point B 4000m. If you travel 1000m in 10 minutes, you will walk the 4000m in 40 minutes. However, this calculation should be done manually by you.

It is worth mentioning that he does not give you the distance walking through streets/roads. He just returns you the distance between two points, nothing more.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.