Points
When working with the Skybrud.Essentials.Maps.Geometry
namespace, the IPoint
interface is the most basic type. By specifying the latitude and logitude properties, it defines a point in the world.
The interface let's you declare your own classes that implement it - eg. in situations where an instance should specify more information than just the latitude and longitude. In most cases, you can however use the Point
class:
// Initialize two points by latitude and longitude
IPoint a = new Point(55.708151, 9.536131);
IPoint b = new Point(55.708069, 9.536000);
Besides telling you where a given point is in the world, an instance of IPoint
doesn't really do much more than that. But by using the DinstanceUtils
class, you can determine the distance between two points:
// Calculate the distance in metres
double distance = DistanceUtils.GetDistance(a, b);
The distance is measured in metres as it's an SI unit.