geolib icon indicating copy to clipboard operation
geolib copied to clipboard

method to extend bounds to certain latlng point

Open Freundschaft opened this issue 11 years ago • 3 comments

is there any plan to include a method that extends existing bounds to a new point similar to what google and leaflet have with ther latlngbounds.extend methods?

cheers Qiong

Freundschaft avatar Apr 05 '14 15:04 Freundschaft

ah I guess it would be possible to extend the polygon of the parameter that is passed to getbounds and thereby extend the resulting bounds object, am I correct?

Best Qiong

Freundschaft avatar Apr 05 '14 15:04 Freundschaft

Do you have an example how Google and Leaflet are doing it? I'm not quite sure if I understood what exactly you are meaning ;)

manuelbieh avatar Jul 01 '14 10:07 manuelbieh

sure: the API provided by google is here: https://developers.google.com/maps/documentation/javascript/reference?csw=1#LatLngBounds

basically you can invoke .extend(LatLng) on a Bounds object and then the LatLngBounds object is extended by that point.

What I do when I run code written by using your library I would use the following instead:

var routePolygon = new Array();
routePolygon.push(new LatLng(lat, lng));
geolib.getBounds(routePolygon)

instead of

LatLngBounds.extend(LatLng);

basically I already figured out how to do it, but it would be nice if the library would work in the same way as Google / Leaflet.

I am working on a couple of other useful additions to the library, so at one point (probably in a month or so, cause I'm going on vacation) I could contribute a couple of additions to the library.

Thanks & Best Regards Qiong

Freundschaft avatar Jul 01 '14 15:07 Freundschaft