leaflet.geodesic
    Preparing search index...

    Class GeodesicGeometry

    Index

    Constructors

    Properties

    geodesic: GeodesicCore = ...
    steps: number

    Methods

    • Creates a circular (constant radius), closed (1st pos == last pos) geodesic linestring. The number of vertices is calculated with: vertices == steps + 1 (where 1st == last)

      Parameters

      • center: LatLng
      • radius: number

      Returns LatLng[]

      resulting linestring

    • Calculates the distance between two positions on the earths surface

      Parameters

      • start: LatLng

        1st position

      • dest: LatLng

        2nd position

      Returns number

      the distance in meters

    • This is the wrapper-function to generate a geodesic line. It's just for future backwards-compatibility if there is another algorithm used to create the actual line.

      The steps-property is used to define the number of resulting vertices of the linestring: vertices == 1 + 2 ** (steps + 1) The value for steps is currently limited to 8 (513 vertices) for performance reasons until another algorithm is found.

      Parameters

      • start: LatLng

        start position

      • dest: LatLng

        destination

      Returns LatLng[]

      resulting linestring

    • Parameters

      • latlngs: LatLng[]

      Returns LatLng[]

    • Parameters

      • multilinestring: LatLng[][]

      Returns number[]

    • Parameters

      • latlngs: LatLng[][]

      Returns LatLng[][]

    • A geodesic line between start and dest is created with this recursive function. It calculates the geodesic midpoint between start and dest and uses this midpoint to call itself again (twice!). The results are then merged into one continuous linestring.

      The number of resulting vertices (incl. start and dest) depends on the initial value for iterations and can be calculated with: vertices == 1 + 2 ** (initialIterations + 1)

      As this is an exponential function, be extra careful to limit the initial value for iterations (8 results in 513 vertices).

      Parameters

      • start: LatLng

        start position

      • dest: LatLng

        destination

      • iterations: number

      Returns LatLng[]

      resulting linestring

    • Handles splitting of circles at the antimeridian.

      Parameters

      • linestring: LatLng[]

        a linestring that resembles the geodesic circle

      Returns LatLng[][]

      a multilinestring that consist of one or two linestrings

    • Is much (10x) faster than the previous implementation:

      Benchmark (no split):  splitLine x 459,044 ops/sec ±0.53% (95 runs sampled)
      Benchmark (split): splitLine x 42,999 ops/sec ±0.51% (97 runs sampled)

      Parameters

      • startPosition: LatLng
      • destPosition: LatLng

      Returns LatLng[][]

    • Linestrings of a given multilinestring that cross the antimeridian will be split in two separate linestrings. This function is used to wrap lines around when they cross the antimeridian It iterates over all linestrings and reconstructs the step-by-step if no split is needed. In case the line was split, the linestring ends at the antimeridian and a new linestring is created for the remaining points of the original linestring.

      Parameters

      • multilinestring: LatLng[][]

      Returns LatLng[][]

      another multilinestring where segments crossing the antimeridian are split

    • Linestrings of a given multilinestring will be wrapped (+- 360°) to show a continuous line w/o any weird discontinuities when wrap is set to false in the geodesic class

      Parameters

      • multilinestring: LatLng[][]

      Returns LatLng[][]

      another multilinestring where the points of each linestring are wrapped accordingly