The RouteBoxer class takes a path, such as the Polyline for a
route generated by a Directions request, and generates a set of LatLngBounds
objects that are guaranteed to contain every point within a given distance
of that route. These LatLngBounds objects can then be used to generate
requests to spatial search services that support bounds filtering (such as
the Google Maps Data API) in order to implement search along a route.
RouteBoxer overlays a grid of the specified size on the route, identifies
every grid cell that the route passes through, and generates a set of bounds
that cover all of these cells, and their nearest neighbours. Consequently
the bounds returned will extend up to ~3x the specified distance from the
route in places.
For a description and examples of how to use this library, check out the how-to.
Constructor | Description |
---|---|
RouteBoxer() |
Creates a new RouteBoxer |
Methods | Return Value | Description |
---|---|---|
box(path:google.maps.LatLng[] | google.maps.Polyline, range:Number) |
google.maps.LatLngBounds[] |
Generates boxes for a given route and distance |