1

I have an app that searches the Google Places API and returns places based on categories that I choose.

The result is a JSON Object that contains a lot of data about each place. I want to share this place via email with other people. I extract the information I want from this object about the specified place by using the following code:

JSONObject geometry = (JSONObject) point.get("geometry");
JSONObject location = (JSONObject) geometry.get("location");
result.setLatitude((Double) location.get("lat"));
result.setLongitude((Double) location.get("lng"));
result.setIcon(point.getString("icon"));            
result.setName(point.getString("name"));
result.setVicinity(point.getString("vicinity"));
result.setId(point.getString("place_id"));
return result; 

The place_id is the CID of the place, which is unique to the place. I want to share this, or be able to show this place by going to Google Maps and search by this unique CID. I construct the web browser URL as follows:

http://maps.google.com/maps/place?cid=ChIJgzzEJr9_24ARNu3LoImy7k4

This doesn't work though, and the web address gets converted to a lat/long, but no place shows here.

Is there an easy way to find a place on a Google Map using this unique CID? Something like a URL that I can share with others in an email or something? That way if I find a cool place and want to share it, I can just pass the URL with this CID?

Wayne Johnson
  • 214
  • 3
  • 18

1 Answers1

2

your "CID" is place id

https://maps.googleapis.com/maps/api/place/details/json?key=YOURKEY&placeid=ChIJgzzEJr9_24ARNu3LoImy7k4

use this link, you can get json which contain all the information for this company, look the bottom of this json

"url" : "https://maps.google.com/?cid=5687679683593497910",

this is the TRUE cid!

Ma Yubo
  • 215
  • 1
  • 10
  • How did you get the "TRUE" CID number? I already get the information about the place when I query the Places API. Shouldn't this data already be contained in the JSON object returned from the initial query? – Wayne Johnson Apr 22 '16 at 15:11
  • you could get CID with place api, the "CID" on your code is the place-id which can be use for place api, then you could query this place-id's json, If you already get the result form place api for javascript, you could try, something like result.url – Ma Yubo Apr 22 '16 at 15:19
  • I already get the CID with the API via the place_id. Shouldn't that "true" CID be located in the JSON object somewhere? I am looking now and the data shows the following: – Wayne Johnson Apr 22 '16 at 15:32
  • {"geometry":{"location":{"lat":33.49268879999999,"lng":-117.1473177}},"icon":"https:\/\/maps.gstatic.com\/mapfiles\/place_api\/icons\/generic_business-71.png","id":"01951b3af43717a7c474e0abf699ec400dddfdc7","name":"Art Y Culture","place_id":"ChIJgzzEJr9_24ARNu3LoImy7k4","reference":"CmRgAAAAsyXINdqYGzQ9Oy-TpDK0Lp515EOnYVggjvuZ1GmFONxt9j143AvYibhnAXwsDDPwQimfkXFm-mNY4-9uXvIUc0EkxxoSB-jpNZ-nrQO5piFXFAUk62-1YZsCUUQ1JIkYEhB8XH0oEx4ZCqeL-izTccNAGhTlTjWoozr-d3j2dCQ_ZWXblAtPow","scope":"GOOGLE","types":["art_gallery","point_of_interest","vicinity":"28690 Old Town Front Street, Temecula"} – Wayne Johnson Apr 22 '16 at 15:32
  • Where did you get the "TRUE" cid from...the "5687679683593497910" number? – Wayne Johnson Apr 22 '16 at 15:33
  • in my json "place_id" : "ChIJgzzEJr9_24ARNu3LoImy7k4", "reference" : "CmRgAAAAioq5y6RkmLAxQpC5HoawB27G0lNks4Y8ihO5edVmpTU9aqyyC3ebmKDdp4BKAGbBl90Io0mi4OnBTIEChwjdC4BQO08Ij48dmOxCAi8RuVbII2LcAajikEw0UzbUCRPLEhCYfQ48NvS4_KleVv6m4-KIGhSACaH39hF066EQffDMCeMKHno_Iw", "scope" : "GOOGLE", "types" : [ "art_gallery", "point_of_interest", "establishment" ], "url" : "https://maps.google.com/?cid=5687679683593497910", "utc_offset" : -420, "vicinity" : "28690 Old Town Front Street, Temecula" – Ma Yubo Apr 22 '16 at 15:36
  • you cannot find URL on your json? – Ma Yubo Apr 22 '16 at 15:38
  • Not in the initial request. I have to create a new request like this to get the URL response: https://maps.googleapis.com/maps/api/place/details/json?key=YOURAPIKEY&placeid=THEPLACEID Seems silly to have to create a second query and parse the JSON response to get the real CID/URL address from there. – Wayne Johnson Apr 22 '16 at 15:58
  • As the documentation says, "A Place Search returns a list of places along with summary information about each place; additional information is available via a Place Details query." Link: https://developers.google.com/places/web-service/search – spiv Apr 26 '16 at 06:11
  • It doesn't work. placeid and cid seems to be different. – Chamnap Jul 19 '16 at 13:49