Skip to content

The Radius

Erick Navarro edited this page Aug 30, 2017 · 2 revisions
    new GeoEvent<GeoPlace>(
            latitude,
            longitude,
            GeoDistances.TWO_KM,
            GeoPlace.class,
            "locations",
            "cl"
    ) {
        @Override
        protected void results(List<GeoPlace> geoPods) {
            for (GeoPlace geoPlace : geoPods) {
                //TODO do something with your objects
            }
        }
    };

The library provide a class with constants to use as your 3rd argument GeoDistances, most of the radius you need will be there, but for other cases this is the trick:

  • 0.01 = 1KM

There is a catch you should be aware. Data type and the consequences of mathematical truncation can play us fool some times, so if you want to make sure your data will be retrieved add 1 extra Km to your radius. If you want everything in 1Km radius better be safe than sorry, ask for 2Km radius.

Clone this wiki locally