Copied!

Distance class

CloneableInstantiable
Methods
public flat()
 

Returns the approximate flat distance between two coordinates using Pythagoras’ theorem which is not very accurate.

  • see http://en.wikipedia.org/wiki/Pythagorean_theorem
  • see http://en.wikipedia.org/wiki/Equirectangular_projection
  • return float The distance in meters
public getFrom()
 
    public getTo()
     
      public greatCircle()
       

      Returns the approximate distance between two coordinates using the spherical trigonometry called Great Circle Distance.

      • see http://www.ga.gov.au/earth-monitoring/geodesy/geodetic-techniques/distance-calculation-algorithms.html#circle
      • see http://en.wikipedia.org/wiki/Cosine_law
      • return float The distance in meters
      public haversine()
       

      Returns the approximate sea level great circle (Earth) distance between two coordinates using the Haversine formula which is accurate to around 0.3%.

      • see http://www.movable-type.co.uk/scripts/latlong.html
      • return float The distance in meters
      public in( $unit)
       
        public setFrom(League\Geotools\Coordinate\CoordinateInterface $from)
         
          public setTo(League\Geotools\Coordinate\CoordinateInterface $to)
           
            public vincenty()
             

            Returns geodetic distance between between two coordinates using Vincenty inverse formula for ellipsoids which is accurate to within 0.5mm.

            • see http://www.movable-type.co.uk/scripts/latlong-vincenty.html
            • return float The distance in meters
            Properties
            protected $from = NULL
             

            The origin coordinate.

            • var \CoordinateInterface
            protected $to = NULL
             

            The destination coordinate.

            • var \CoordinateInterface
            protected $unit = NULL
             

            The user unit.

            • var string
            Methods
            protected convertToUserUnit( $meters)
             

            Converts results in meters to user's unit (if any).

            The default returned value is in meters.

            • param float $meters
            • return float
            © 2025 Bruce Wells
            Search Namespaces \ Classes
            Configuration