Google geocoding API setup finding the correct ClientID and Secret -
i building java web application requires googles geocoding service defined on https://developers.google.com/maps/documentation/geocoding/ . application setup , works, attempting sign requests allow additional features api such additional rate limits billing ect...
the problem having cant seem proper client id , key works geocoding api. used every sensible combination of id , key api access tab on google's api console. test credentials , have copied php code directly google @ http://gmaps-samples.googlecode.com/svn/trunk/urlsigning/index.html ensure requests signed correctly. watched google developers video topic (https://www.youtube.com/watch?v=odexo7yiwvg) , shows being done google business account, after reading through google's api docs seem not have have business account use geocoding service cant seem valid client id , key work me. know of correct setup use service on non business account? or possible? (keep in mind server server connection)
if needs additional information let me know. grateful suggestions.
edit: looking @ usage limits listed on https://developers.google.com/maps/documentation/geocoding/#limits see implies can use geocoding api without business account.... how?
i went through documentation , have rightly pointed out not need business account use geocoding api. if have non business account need pass api key. client id required if have business account. key unique mentioned below :
https://developers.google.com/console/help/#whatiskey
an api key unique key generate using console. when application needs call api that's enabled in project, application passes key api requests key=api_key parameter. use of key not require user action or consent, not grant access account information, , not used authorization.
according link below client id used instead of key in case of business accounts.
https://developers.google.com/maps/articles/v2tov3#newkey
if maps business customer, need use client id in place of key. note 2 cannot used together. client ids similar keys, following differences:
maps business applications using client id may have access additional features or limits, such maps analytics.your client id given google enterprise support. not need use api console.
when loading google maps javascript api, use client parameter instead of key parameter.
i'm guessing same principle applies geocoding api. if want additional feature not part of non business account have business account.
i ran following code using key sign request in java , works perfectly.
public static string getaddress(string latitude, string longitude){ string address = null; try { final string inputurl = "http://maps.googleapis.com/maps/api/geocode/xml?latlng="+ latitude + "," + longitude + "&sensor=true"; // sign url using key string url = getrequesturl(inputurl); url = "http://maps.googleapis.com" + url; final url google = new url(inputurl); final urlconnection geocode = google.openconnection(); final bufferedreader in = new bufferedreader(new inputstreamreader( geocode.getinputstream())); string inputline; while ((inputline = in.readline()) != null) { address += inputline; } in.close(); } catch (exception e) { // todo: handle exception e.printstacktrace(); } return null; } public static string getrequesturl(final string inputurl) throws ioexception, invalidkeyexception, nosuchalgorithmexception, urisyntaxexception { // convert string url can parse final url url = new url(inputurl); final urlsigner signer = new urlsigner("*insert key here*"); final string request = signer.signrequest(url.getpath(), url.getquery()); return request; }
Comments
Post a Comment