0
votes

the below link (Maps API) finds Kensington San Diego as a neighborhood. https://maps.googleapis.com/maps/api/geocode/json?address=kensington,%20san%20diego

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Kensington",
               "short_name" : "Kensington",
               "types" : [ "neighborhood", "political" ]
            },
            {
               "long_name" : "San Diego",
               "short_name" : "San Diego",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "San Diego County",
               "short_name" : "San Diego County",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "California",
               "short_name" : "CA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Kensington, San Diego, CA, USA",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 32.777394,
                  "lng" : -117.0968502
               },
               "southwest" : {
                  "lat" : 32.755116,
                  "lng" : -117.1127622
               }
            },
            "location" : {
               "lat" : 32.7668062,
               "lng" : -117.1058848
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 32.777394,
                  "lng" : -117.0968502
               },
               "southwest" : {
                  "lat" : 32.755116,
                  "lng" : -117.1127622
               }
            }
         },
         "place_id" : "ChIJQXneX0pU2YARsIgYMQOsyks",
         "types" : [ "neighborhood", "political" ]
      }
   ],
   "status" : "OK"
}

The link below (Places API) cant find it https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=36.26361161176487,-115.12227065576182&keyword=kensignton,%20san%20diego&rankby=distance (Of course this one wont work without an API key but even with a key it responds with ZERO_RESULTS)

{
   "html_attributions" : [],
   "results" : [],
   "status" : "ZERO_RESULTS"
}

However I can't use map api to find starbucks near me (I tried and it sent me to Canada). So...how can I search for either starbucks, neighborhood, or address and get reasonable results

1
some lame person downvoted the question...meh - user438431

1 Answers

1
votes

I'm not sure what you mean by "as a neighborhood", but the link below will return kensington, san diego (be sure to use your API key). The details returned are obviously different from the maps search.

https://maps.googleapis.com/maps/api/place/textsearch/json?location=36.26361161176487,-115.12227065576182&query=kensignton,%20san%20diego&key=your-api-key

For this type of search, try using a textsearch instead of a nearby search, and replace 'keyword, or name' with 'query'.

Go to this page and scroll to the section titled 'Text Search Requests' for more info. https://developers.google.com/places/web-service/search