Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e0ee3ac
Extended redraw() method to fix behavior during editing
qnstie Jul 17, 2013
8ba3c19
commit start of work, so no files are pending for new release
jonatkins Jul 31, 2013
243ef14
first attempt at geodesic circles - for #292 (alsao see #201 and #425)
jonatkins Aug 2, 2013
8dda50f
fix geodesic circle radius - was scaling the radius by PI
jonatkins Aug 2, 2013
066e6bd
in geodesic line calculation, add the final point unmodified rather t…
jonatkins Aug 4, 2013
0ff610f
fix geodesic circle - formula had errors! https://plus.google.com/108…
jonatkins Oct 20, 2013
87fa20b
geodesic lines - improved handling of lines that cross the antimeridi…
jonatkins Oct 27, 2013
a563ae4
geodesic lines: improve the handling for lines that extend beyond the…
jonatkins Nov 21, 2013
fc18687
Spell checking, d-g.
nexushoratio Nov 23, 2013
0c87d3c
Spell checking, s-z, plus a couple of missed ones.
nexushoratio Nov 24, 2013
1e3a9a2
work-around for mobile-specific geodesic line drawing issue - appears…
jonatkins Dec 15, 2013
964e3d4
geodesic line drawing: alternative intermediate point calculation cod…
jonatkins Dec 19, 2013
0761564
increase min line segments used for geodesic circles - improves porta…
jonatkins Jan 5, 2014
75aae58
geodesic: remove dependancy on L.LatLng.DEG_TO_RAD/RAD_TO_DEG, in pre…
jonatkins Mar 22, 2014
b8d2450
earth radius: change leaflet and leaflet-draw to use the radius value…
jonatkins Mar 12, 2015
8a3729d
external: L.Geodesic.js: add workaround to fix GeodesicCircle drawing…
May 10, 2019
205ff94
L.GeodesicCircle: change private property name
Aug 3, 2019
0892da4
cleanup and minor fixes
Aug 2, 2019
a053a1f
update example
Aug 4, 2019
8b7f6d1
add examples/circle.html
Aug 5, 2019
4713e07
update README.md
Aug 5, 2019
39c4fba
use constants
Aug 5, 2019
e6e8bf4
style issues
Aug 23, 2019
3358ab4
refactor: _geodesicConvertLine* are methods now
Aug 23, 2019
f09bbd3
distinguish polygons using instanceof (instead of additional argument…
Aug 23, 2019
4d54906
minor change in inheritance
Aug 23, 2019
c303d67
replace precision-related constants with options
Aug 23, 2019
3b07154
refactor: more consistent set of overriden methods
Aug 23, 2019
43a1a78
remove convertLatLngs-related loop
Aug 23, 2019
4a57cf9
refactor _processPoly from _geodesicConvertLines
Aug 23, 2019
2b502e8
refactor geodesicConvertLine
Aug 23, 2019
deb6da8
geodesicConvertLine: push only intermediate points
Feb 22, 2020
c9f84ab
Merge pull request #3 from IITC-CE/refactor
Feb 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitmodules

This file was deleted.

54 changes: 42 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
[Leaflet.Geodesic](http://fragger.github.io/Leaflet.Geodesic/)
[Leaflet.Geodesic][example]
================

### Description
Geodesic polylines and polygons for [Leaflet](https://github.com/Leaflet/Leaflet)

Adds:
```
L.GeodesicPolyline( <LatLng[]> latlngs, <Polyline options> options? )
L.GeodesicPolygon( <LatLng[]> latlngs, <Polyline options> options? )
L.GeodesicMultiPolyline( <LatLng[][]> latlngs, <Polyline options> options? )
L.GeodesicMultiPolygon( <LatLng[][]> latlngs, <Polyline options> options? )
```
These will follow the curvature of the Earth and are used just like the normal versions of the constructors that are rendered as straight lines on the screen
Geodesic polylines, polygons and circles for [Leaflet](https://github.com/Leaflet/Leaflet) 1.x.

These will follow the curvature of the Earth and are used just like the normal versions of the constructors that are rendered as straight lines on the screen.

[example]: https://raw.githack.com/IITC-CE/Leaflet.Geodesic/master/examples/index.html


`L.GeodesicPolyline`
------------------

**L.geodesicPolyline**(<LatLng[]> _latlngs_, <[Polyline options]> _options?_)

- [Example]

[Polyline options]: https://leafletjs.com/reference-1.5.0.html#polyline-option


`L.GeodesicPolygon`
------------------

**L.geodesicPolygon**(<LatLng[]> _latlngs_, <[Polyline options]> _options?_)


`L.GeodesicCircle`
------------------

**L.geodesicCircle**(<[LatLng]> _latlng_, <[Circle options]> _options?_)

- [Example][example-circle]

[example-circle]: https://raw.githack.com/IITC-CE/Leaflet.Geodesic/master/examples/circle.html

<details><summary>
(obsolete way)
</summary>

**L.geodesicCircle**(<[LatLng]> _latlng_, <Number> _radius_, <[Circle options]> _options?_)
</details>

[LatLng]: https://leafletjs.com/reference-1.5.0.html#latlng
[Circle options]: https://leafletjs.com/reference-1.5.0.html#circle-option
50 changes: 50 additions & 0 deletions examples/circle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.Geodesic example</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"/>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="../src/L.Geodesic.js" ></script>
<style>
html, body {
height: 100%;
margin: 0;
}
#map {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map = L.map('map').setView([0, 0], 1);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors, CC-BY-SA',
maxZoom: 18
}).addTo(map);

var center = [75,0];
var point = [62,0]
var radius = map.distance(center,point);
var geodesiccircle = L.geodesicCircle(center, {radius: radius, color: 'red'}).addTo(map);
var circle = L.circle(center, {radius: radius, color: 'blue'}).addTo(map);

var pointMark = L.marker(point, {draggable: true}).addTo(map).on('drag',function () {
point = pointMark.getLatLng();
radius = map.distance(center,point);
circle.setRadius(radius);
geodesiccircle.setRadius(radius);
});
var centerMark = L.marker(center, {draggable: true}).addTo(map).on('drag',function () {
center = centerMark.getLatLng();
circle.setLatLng(center);
geodesiccircle.setLatLng(center);
var bounds = circle.getBounds();
pointMark.setLatLng([bounds.getSouth(), center.lng]);
});
</script>
</body>
</html>
33 changes: 21 additions & 12 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
<!DOCTYPE html>
<html>
<head>
<title>Leaflet.Geodesic example</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="lib/Leaflet/dist/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="lib/Leaflet/dist/leaflet.ie.css" />
<![endif]-->
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"/>
<script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"></script>
<script src="../src/L.Geodesic.js" ></script>
<style>
html, body {
height: 100%;
margin: 0;
}
#map {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="lib/Leaflet/dist/leaflet.js"></script>
<script src="../src/L.Geodesic.js" ></script>
<script src="lib/leaflet-tilejson/src/tilejson.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="osm.tilejson.js"></script>
<script>
var map = L.TileJSON.createMap('map', osmTileJSON);
var map = L.map('map').setView([11.9, 57.7], 8);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors, CC-BY-SA',
maxZoom: 18
}).addTo(map);

var latlngs = [[40.71435280, -74.0059731],[48.8566140, 2.35222190]]

var mark1 = L.marker(latlngs[0], {draggable: true}).addTo(map).on('drag', update);
Expand All @@ -37,4 +46,4 @@
}
</script>
</body>
</html>
</html>
1 change: 0 additions & 1 deletion examples/lib/Leaflet
Submodule Leaflet deleted from c1d410
1 change: 0 additions & 1 deletion examples/lib/leaflet-tilejson
Submodule leaflet-tilejson deleted from 94eead
17 changes: 0 additions & 17 deletions examples/osm.tilejson.js

This file was deleted.

11 changes: 0 additions & 11 deletions examples/style.css

This file was deleted.

Loading