LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Google Places API JSon Data (https://www.linuxquestions.org/questions/programming-9/google-places-api-json-data-4175485321/)

trscookie 11-20-2013 09:23 PM

Google Places API JSon Data
 
Hello All,

I am trying to retrieve data from Google's Places API but I only seem to receive partial data using the examples provided:

Code:

https://maps.googleapis.com/maps/api/place/radarsearch/json?location=48.859294,2.347589&radius=5000&types=food|cafe&sensor=false&key=MyAPIKey

This is the end part of the result, it does not seem to contain the 'Address' or the 'Name' in the data, what could I be missing?:

Code:

      {
        "geometry" : {
            "location" : {
              "lat" : 48.854067,
              "lng" : 2.336876
            }
        },
        "id" : "cbf69cd8c0c5874e65826804ca32804cc05554a6",
        "reference" : "CnRpAAAASJHvjkWfbiNVXPiSM1LZ9W0bUsNkpNg8MQxSDMnoVcWEpnaTVQQ13ACQe70uARaag9ROrYF7CO64gz2K7l3vAntax4HCQ970DznSz3kRuYC1eMjy8UY6oqyXCjUQA4wdaJNCipmlot4VweOmsdnQzhIQxjGWlwDvtGVV_mryMBpHDBoUjNOjbu4s3beu-RLTfUUAClgNWZU"
      },
      {
        "geometry" : {
            "location" : {
              "lat" : 48.859226,
              "lng" : 2.343194
            }
        },
        "id" : "81043f004b7a10b8aa90b22abf26d7ba9e6ddbd2",
        "reference" : "CnRpAAAAQ1WqarpjVxRV3KzjHLr1leK5tz-biVJKpsubYxdz_2RobMOomm3NdQBGH6rJ-o3SpqEawofy1nHYGfzRKzj22EBB--twS7t8b0pDAHMcRKq84Pt7IhFBlxqw0TJ-k4AEFQOkZKsNJmgC8D9PcdP3mhIQnGEFSKW6XuuY97IhsQsCqRoUUMzTb3hlQALd6lfi551fDNKSeGU"
      },
      {
        "geometry" : {
            "location" : {
              "lat" : 48.865602,
              "lng" : 2.327369
            }
        },
        "id" : "751a05ec173f53ba581d8a32e047a69302c4886c",
        "reference" : "CnRwAAAAY_M2ykIP9uhznSrhX3ZQivZppc2QN-26u42VHLB-sFFuhtKUItpnazRuEYyG2YWlAWAiyh1U-vC8TvnKcIHsAWGJbPnu7JrljZFsE8YUHFuRUXg1DJC-tSBKljE8humdTgpBDXqSK-0cXTo3bpyy5RIQ-1MKJwToG7YgDqIoL6txOhoUjFke09XGZbo5w1wJZgp___6cnwI"
      },
      {
        "geometry" : {
            "location" : {
              "lat" : 48.854614,
              "lng" : 2.332805
            }
        },
        "id" : "ae281cf5bdb180a0724b37969414efe000a705c1",
        "reference" : "CpQBiQAAALaBY5SzqfFSXSVoyyy3w9N0I5xajK7R7jisN23Ll9EBkFnr8XQ7KZsLxsqj0S4DshxGPtEoIi1jvrdB_iZ6Xt9jR4gViQoRV3U8UyrDwzHYUvAhRZj06UNGZL9lkJrZkaIZM9hb6StBnI709UUeWzujDDSvuz2yVtF3IB2TWyDQ21F1ShFMYMyUOCJWnFeEVxIQX8PSx8RVsgYA_4fpyS395BoUWOmPr84ZfZg92isCZRxxpnjdJI0"
      }
  ],
  "status" : "OK"
}


Every example that I see online appears to retrieve information like this:

Code:

{
  "html_attributions" : [],
  "results" : [
      {
        "geometry" : {
            "location" : {
              "lat" : 33.7862590,
              "lng" : -117.8531270
            }
        },
        "icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
        "id" : "5be9a13a28635cf8fd2ef3c62c24d51277a4ba58",
        "name" : "Kimmies Coffee Cup",
        "rating" : 3.30,
        "reference" : "CnRpAAAANKLoOHJ1STFaFavIPjm2bpMDneGTv0AXfixyl-koF7KSK-lQSldk3c01RFJu9Gf62zXnRScte-dkPCBU8KuxCo7AMctfuaIhNkPE8RKENF9HeMlkuEg-Scp97--1VWJvjpNQjc6xRvdXsbf7V8NrSRIQnXjZBKbrSeSg2sTwBosKghoUEFlNDIN5cnVbn5n7aNtwycord-E",
        "types" : [ "restaurant", "food", "establishment" ],
        "vicinity" : "190 S Glassell St # B, Orange"
      }
      ]
}

Many thanks for your help.

trscookie

OMouse 12-08-2013 03:13 PM

I would suggest looking at the updated Google Places API Docs: https://developers.google.com/places...SearchRequests

The examples now show that the results returned include a field called "formatted_address":

"results" : [
{
"formatted_address" : "529 Kent Street, Sydney NSW, Australia",
"geometry" : {
"location" : {
"lat" : -33.8750460,
"lng" : 151.2052720
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "827f1ac561d72ec25897df088199315f7cbbc8ed",
"name" : "Tetsuya's",
"rating" : 4.30,
"reference" : "CnRmAAAAmmm3dlSVT3E7rIvwQ0lHBA4sayvxWEc4nZaXSSjRtfKRGoYnfr3d5AvQGk4e0u3oOErXsIJwtd3Wck1Onyw6pCzr8sw W4E7dZ6wP4dV6AsXPvodwdVyqHgyGE_K8DqSp5McW_nFcci_-1jXb5Phv-RIQTzv5BjIGS0ufgTslfC6dqBoU7tw8NKUDHg28bPJlL0vGVWVgbTg",
"types" : [ "restaurant", "food", "establishment" ]
},

There's more detail about the results returned here: https://developers.google.com/places...eSearchResults


All times are GMT -5. The time now is 05:25 PM.