leaflet-geodesy

0.2.1 • Public • Published

leaflet-geodesy

A Leaflet plugin for the earth.

install

With browserify

npm install --save leaflet-geodesy

Via the Mapbox.js Plugin CDN: https://www.mapbox.com/mapbox.js/plugins/#leaflet-geodesy

Otherwise

https://raw.github.com/mapbox/leaflet-geodesy/gh-pages/leaflet-geodesy.js

api

Either via require('leaflet-geodesy') or the LGeo object when used without browserify.

geodesy.circle(center, radius, opt)

Given center as L.latLng or [lat, lon] and radius in meters, and opt being all path options plus parts for sections to draw, create a L.polygon layer of a real-earth circle.

The generated layer supports:

  • setLatLng(center): set a new centerpoint
  • setRadius(radius): adjust radius
  • getRadius(): get radius
  • toGeoJSON(): get GeoJSON representation

geodesy.area(layer)

Given a L.Polygon layer, return the physical area contained within.


  • spherical does the work behind the scenes
  • everything is wgs84-based

Package Sidebar

Install

npm i leaflet-geodesy

Weekly Downloads

493

Version

0.2.1

License

BSD-2-Clause

Last publish

Collaborators

  • mapbox-admin