0

I am trying to let the use mark some locations on map, is there any way to do so? something like what happens when trying to get direction in maps and choosing option choose location on maps. I need something like that so that the user chooses a location and then i get longitude and latitude of the chosen location.

I've searched a lot but i did not find anything like this, can anyone help me with that?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Omid Karami
  • 2,675
  • 2
  • 13
  • 17
  • This might be helpful: http://stackoverflow.com/questions/24302112/how-to-get-the-latitude-and-longitude-of-location-where-user-taps-on-the-map-in – System developer Jan 13 '17 at 22:49

1 Answers1

1

if I understand, you want to get, for example, visible map area bounds? If yes, you can get visible area bounds:

VisibleRegion visibleRegion = mMap.getProjection().getVisibleRegion();
LatLngBounds latLngBounds = visibleRegion.latLngBounds;

If you want to select (mark) some area, something like this: example picture

You should use polygon

And, you can get callback, when user tap on the map for detect: if user tap at polygoned area.

map.setOnMapClickListener(new OnMapClickListener() {
        @Override
        public void onMapClick(LatLng clickedLocation) {
                float lat = clickedLocation.latitude;
                //...
        }
    });

If you want to give user permission to SELECT (draw) area, use onMapClick for get list of points for drawing polygon and after clicking on some button draw polygon.

Hope this helps!=)

РСИТ _
  • 325
  • 1
  • 14