4

Is there a working way (i heard that as of update 7.0 there were some changes) to display a marker with a position given by latitude/longitude with a label?

geo:?q=latitude, longitude (Label) does not work...

laalto
  • 150,114
  • 66
  • 286
  • 303
joz
  • 652
  • 2
  • 8
  • 19
  • you are going to have to be more specific, update 7.0 of what? – tyczj Sep 10 '13 at 16:42
  • sorry;D of google maps:) – joz Sep 10 '13 at 17:24
  • You might want to keep an eye on this: http://productforums.google.com/forum/#!category-topic/mobile/android-devices/maps-earth-latitude/B7mqPzukV9I – Geobits Sep 10 '13 at 18:11
  • Thank you:) so there isn't a solution yet is it? – joz Sep 10 '13 at 23:18
  • From the lack of responses there, I'm not sure they see it as a problem, much less have a solution. You have to remember, `geo:` intents are intended for use in many applications, so something that *happens* to work in Google Maps only is a likely target for removal. – Geobits Sep 11 '13 at 13:06

1 Answers1

6

Show point on google map via an intent:

String uri = "geo:"+ latitude + "," + longitude;

startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));

You can also choose to place a point like so:

String uri = "geo:"+ latitude + "," + longitude + "?q=my+street+address";

startActivity(new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri)));

The Possible Query params options are the following:

  • Show map at location: geo:latitude,longitude

  • Show zoomed map at location: geo:latitude,longitude?z=zoom

  • Show map at location with point: geo:0,0?q=my+street+address

  • Show map of businesses in area: geo:0,0?q=business+near+city

gianlucaparadise
  • 1,678
  • 20
  • 32
wSakly
  • 387
  • 1
  • 10
  • thanks for your effort :) .. i know this is from the documentation, but the one i was using before was this : String uri = "geo:"+ latitude + "," + longitude + "?q=my+street+address"; Problem is that this only searches for the "my+street+adress"-part and therefore is far more unaccurate than the gps-data – joz Sep 10 '13 at 17:22
  • Try to open GPS after starting Activity and if you are using the emulator you should semilate the latitude,longitude.and what is the update 7.0?? – wSakly Sep 10 '13 at 17:29
  • I don't exactly know what you mean... I'm using a real device with gps enabled (galaxy s3) ... but my issue has nithing to do with the gps sensor of my phone, does it? – joz Sep 10 '13 at 23:17
  • You can try to use this code for Map v2 http://bon-app-etit.blogspot.be/2012/12/add-informationobject-to-marker-in.html – wSakly Sep 11 '13 at 08:16
  • Problem is that this doesn't use an intent rather than using a fragment which i have to implement in my app ;D .. But i might use this in the future anyways ;D – joz Sep 11 '13 at 13:04
  • A question, can i add by query a .kml file route with this method? – Juan_H Nov 13 '20 at 21:41
  • 1
    Important bit, "geo:latitude,longitude" will not create a point on map. For that you need to write coordinates in the query part. For example: "geo:?q=latitude,longitude" – AndrazP Dec 17 '21 at 15:37
  • Thanks @AndrazP, using `geo:lat,long?q=blah` performed a query search for me and listed the results, it did not show the location with a pin. AndrazP comment is correct, this should be `geo:?q=lat,long` to show a point on the map – behelit Aug 04 '23 at 04:30