Make a mark on the Google Maps map itself

Asked

Viewed 104 times

0

I wonder if there is any way to leave a mark on a certain part of the map of Google Maps (android). I’m not saying in marker form, I’m wanting for example to leave an area close to my house with a red spot on the map (or other color). Is it possible to do this on android? Thanks.

  • beauty! But when you ask a question, try to be very clear. If you had inserted that image of your comment here in your question, I wouldn’t have even added the answer. Good luck!

  • Sorry my dear . I just thought to add the image Depoid, more anyway thank you so much for trying to help.

1 answer

2


On the map you can add references with addMarker, addCircle, addPolyline and addPolygon.

In the link image was probably used addPolygon.

It also has addGroundOverlay, as well as Circle a Polyline and Polygon the Ground accompanies the rotation and tilt zoom of the map.

In the example I drew a star-shaped png 256x256. See the result:

       @Override
       public void onMapReady(GoogleMap map) 
       {

         GroundOverlayOptions options = new GroundOverlayOptions();
         LatLng latLng = new LatLng("lat","lng"); // posição que deseja adicionar a marca

         options.position(latLng,400,400); // 400 - raio em metros
         options.image(BitmapDescriptorFactory.fromResource(R.drawable.ground));
         options.clickable(false);

         map.addGroundOverlay(options);
      }

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • Hello friend, first of all thank you, it seems that this is what I need! I would just like to confirm one thing with you: how do I choose the position on the map of this image? Because you wrote in the 400 that it was the ray, so it’s not the position where the star is, right? Or that 400,400 is the coordinates?

  • I tried to create a "Latlng position = new Latlng(-23.557924, -46.660552)" and put in the "options.position(position,400,400);", however, gives error when opening the application. I’m probably putting it in the wrong place.

  • You downloaded the image to use as Ground?

  • Yes. And I added that code to Activity’s Oncreate, are you at the right place? If need edit my question and put my code to try to help me

  • Post the code, you add the tag later and get the map instance in onMapReady, as per Cleidimar Viana’s post.

  • Hey, buddy, thanks a lot. It was my own slip, I was used to putting things on Oncreate because of other projects and I did not care that it was on Onmapready that I had to put. It worked perfectly, that’s exactly what I wanted. Thank you so much for the real help.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.