Created
March 28, 2013 21:11
-
-
Save ebrelsford/5266833 to your computer and use it in GitHub Desktop.
A mixin for L.LatLngBounds that adds a toGeoJson method.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L.extend(L.LatLngBounds.prototype, { | |
toGeoJson: function() { | |
return { | |
'type': 'Polygon', | |
'coordinates': [[ | |
[this.getSouthWest().lng, this.getSouthWest().lat], | |
[this.getNorthWest().lng, this.getNorthWest().lat], | |
[this.getNorthEast().lng, this.getNorthEast().lat], | |
[this.getSouthEast().lng, this.getSouthEast().lat], | |
[this.getSouthWest().lng, this.getSouthWest().lat], | |
]], | |
} | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Thanks for making this!