Skip to content Skip to sidebar Skip to footer

How To Get Place Or Placeid By Latlng In Android Using Google Places Api?

How to get place or placeid by latLng in android using google places api ? I want to get place or placeid when i get latLng

Solution 1:

you can use this Google Maps API

http://maps.googleapis.com/maps/api/geocode/json?latlng=23.00,72.57&sensor=true

Solution 2:

I have implemented in my application using this way

https://maps.googleapis.com/maps/api/geocode/json?latlng=21.1702401,72.8310607&key=YOUR_API_KEY

u will get Response like this which contains place_id.

{
   "results" : [
      {
         "address_components" : [
           //It contains postal code and details
         ],
         "formatted_address" : "22 Demart, Surat, India,
         "geometry" : {
            "location" : {
               "lat" : 21.1702401,
               "lng" : 72.8310607
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 21.1702401,
                  "lng" : 72.8310607
               },
               "southwest" : {
                  "lat" : 21.1702401,
                  "lng" : 72.8310607
               }
            }
         },
         "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
         "types" : [ "street_address" ]
      },

   ... Additional results truncated in this example[] ...

   ],
   "status" : "OK"
}

you can refer this link also

https://developers.google.com/maps/documentation/geocoding/start

Hope this will help u..u can ask if any question

Solution 3:

Both of the proposed ways - cost money and I think peoples should mention it. Yes, we have the -$200 from the Google, but its all depends from how much users you have and how frequent you need to use the geocoder. 60k requests per month to the geocoder - easy $300 only for to use the geocoder :

Nov 1 – 30, 2018 Geocoding API Geocoding: 6073 Counts - $30.38

Dont filter what you need in the responses, like we have in the requests from other posts? Expect way more:

Nov 1 – 30, 2018 Places API Places Details: 2389 Counts $40.61

Nov 1 – 30, 2018 Places API Contact Data: 2385 Counts $7.17

Nov 1 – 30, 2018 Places API Atmosphere Data: 2385 Counts $11.95

Post a Comment for "How To Get Place Or Placeid By Latlng In Android Using Google Places Api?"