Reputation: 817
I want to allow user to select a region on Map( Could be state,city, or combinations of city or any small region like apartment community). User can draw a circle by hand gesture or by some other interactive way to select the region.
Based on that region, I want to do some computing. (So i would probably need coordinates and radius of selection or area of selection)
Is it possible to use Google maps for this purpose? If yes, how. Any references would be appreciated.
Upvotes: 0
Views: 3182
Reputation: 22232
There are many ways to do this.
The easist would be to handle onMapClick
s: on the first click you store central LatLng
, on the second, you calculate radius using Location.distanceBetween
and create Circle
out of it.
The above seems like a bad UX, so you could also try having an overlay View
that consumes DOWN
and MOVE
MotionEvent
s. On DOWN
you create Circle
object, on MOVE
you update its radius.
Conceptually this answer could also help you with the second approach: How to draw a shape dynamically on map touched location in android.
Upvotes: 2