2
Googleの場所APIから写真参照文字列を取得する方法を見つけようとしています。これはgoogleのフォーマットです:写真参照を取得する
"photos" : [
{
"height" : 768,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/114756359878708427597/photos\"\u003eHotel Olympic\u003c/a\u003e"
],
"photo_reference" : "CmRdAAAAGWSabKG9f1wwRa1-dg0RVlb_m54RQDO023QTxEgOdFvlE2KjnK9Saxiqnxanr0yTCdbEg183RUk0kncFVwmFoQ8kn5yjnPHGZ-3-vi8Jck-6MbfJLU__h7hibPJ4tko3EhAhSR1B_4-eT4c6A_s_32I_GhTFiO19eMhOD5x5xYfB4DN3ABOtKA",
"width" : 1024
}
]
写真参照文字列はどのように取得できますか?ちょうどそれを得る方法はありますか、私は他の何かをしなければなりませんか?
これは私のJavaコードである:多くのコードがあるOfcource jPlaceがGoogleからの場所です
private HashMap<String, String> getPlace(JSONObject jPlace){
HashMap<String, String> place = new HashMap<String, String>();
String photo_reference= "-NA-";
if(!jPlace.isNull("photos")){
//something to do here
}
//a string builder here to create the url
place.put("photo", theUrl);
}
はJSONObjectフォーマット
でAPIを配置しますが、私はちょうど私がjsonObject
を得る部分をアップロード
あなたはphoto_reference文字列を得るよりもjson文字列を解析するだけです。 –