Creating regions is designed to be easy for the user and you (the developer).
The Example Application contains a great way you might want to allow your users to choose a region to download, and it shows how to use Provider to share a created region and the number of approximate tiles it has to a download screen.
All regions (before conversion to DownloadableRegion
) implement BaseRegion
.
The most basic type of region, defined by two North West and South East coordinates that create a LatLngBounds
.
A more advanced type of region, defined by a center coordinate and radius (in kilometers).
If you have two coordinates, one center, and one on the edge of the circle you want, you can use 'latlong2's Distance.distance()
method, as below:
The most advanced type of region, defined by a list of coordinates and radius (in meters).
After you've created your region, you can convert it to a drawable polygon (below), or convert it to a DownloadableRegion
ready for downloading.
All BaseRegions
can be drawn on a map with minimal effort from you or the user, using toDrawable()
.
Internally, this uses the toOutline(s)
method to generate the points forming the Polygon
, then it places this/these polygons into a PolygonLayer
.