MGMLaboratory
Back

Menu

01Home
02About Us
03Projects
04Publications
05Member
06Articles
07Contact

Let's Talk

Open in Mail app

Socials

Malang (ID) --:--Privacy PolicyTerms of Service

September 1, 20162 min read

Bounding boxes along a route, now as an Android libraryBounding boxes along a route, now as an Android library

RouteBoxer takes a route and a distance and returns a small set of rectangles that cover everything nearby.

  • Conference
  • Publications

Written by

  • SRShirasaka RenIT & Infrastructure · Student Member

In this article

  1. 01How the boxes are built
  2. 02Why it was ported to Android

A navigation app spends a lot of time answering questions about proximity. Which restaurants sit near this route? Which drivers are close to the path? Testing every candidate against a long polyline is slow, and most spatial indexes cannot help with a line shape.

RouteBoxer turns that line problem into a rectangle problem. Hand it a route and a distance, and it returns a set of bounding boxes that cover the area within that distance of the route. From there a database can filter on boxes before anything precise runs.

A route sign at dawn. A route becomes a set of rectangles for spatial queries. Photo: ZeLonewolf, CC0.
Fig. 01A route sign at dawn. A route becomes a set of rectangles for spatial queries. Photo: ZeLonewolf, CC0.

01/02

How the boxes are built

  • Take the bounding box of the whole route and extend it by one grid cell in every direction.
  • Overlay a grid of square cells across that area, where the cell size follows the distance you asked for.
  • Mark every cell that intersects a vertex of the route, along with the eight cells surrounding it.
  • Merge the marked cells into as few non overlapping rectangles as the shape allows.

The merge step is where the practical value sits. Fewer rectangles means fewer lookups later, so the output is a compact cover of the corridor rather than a raw pile of grid squares.

A road network from map data. Route corridors drive spatial queries. Map data: OpenStreetMap, CC BY-SA 2.0.
Fig. 02A road network from map data. Route corridors drive spatial queries. Map data: OpenStreetMap, CC BY-SA 2.0.

02/02

Why it was ported to Android

RouteBoxer was originally a helper for maps in the browser. The authors ported it to Android because mobile developers had no equivalent, building the work on the Google Maps Android API inside Android Studio and shipping it as a library. It can be added to a project either as a compiled library file or as a source module.

One property of the algorithm deserves attention before use. The authors report that the number of generated boxes grows exponentially as the distance increases. A wider corridor is not a little more expensive, it is a lot more, so the distance parameter and the grid resolution are the two knobs to watch.

A phone showing a route on a map. Boxes are what the app queries against. Photo: Santeri Viinamaki, CC BY-SA 4.0.
Fig. 03A phone showing a route on a map. Boxes are what the app queries against. Photo: Santeri Viinamaki, CC BY-SA 4.0.

Source

  1. Pinandito, A., Saputra, M.C., Perdana, R.S. (2016). RouteBoxer library for Google Android platform. 2016 IEEE Asia Pacific Conference on Wireless and Mobile (APWiMob).

    DOI10.1109/APWiMob.2016.7811440 (opens in a new tab)

Next articleJagoan Indonesia, a 2016 Pilot Project with Mirai Education(Keep scrolling)(Read it next)(Loading)