搜尋地標,可分為使用 type, keyword, radar 三種方式 ( 詳細內容可參考
Google Places API Web Service )
(1)
type:送出 https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=座標&radius=搜尋範圍&types=種類&sensor=true&key=server api key
範例:
//呼叫API
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=24.1674116,120.6679557&radius=5000&types=bank&sensor=true&key=AIzaSyC9nSWENfNXaPrQ9pMFtvxL5NSwbpMiEE
//回傳 { "htmlattributions" : [], "nextpage
token" : "CoQC8gAAAB6cvLyq0yHNFy6xoBRrpTVsUCLD2kVsvcSIrXiRRfrnvE9jFUzdq-sRLbKq4Q5bHCrcN1SwayQcDsvsADKuHbx5ucnVZa0l85iAUm9kzGtEiMK1NcJWiHxNe0REVWYwDAz0kXUSlu3rKfR26VNoBORPXxRcagaRfAKHZHqKTplmCOw0gZOR70drr6eZXFGhymSaZ5jSlaoQL9-bel4hfqZOaLekWYpjr9gSI7X-Op66wWpeFKYeVPleA6heArUDBsHt8js4ykSAPRk4I22ikcUonw98BxbZmgAjt6hQd8zuhs5v9QI4046TBpZ0oHNjGzTznWs9vB91BK1hTEAQSEGS91M0wqOcKJHBQBSHhMx8aFLzuXUD3ha6M1ob3VM4-uxeXps8N",
"results" : [
{
"geometry" : {
"location" : {
"lat" : 24.161911,
"lng" : 120.651707
}
},
"icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/genericbusiness-71.png",
"id" : "48b7e2d33ccc3897eed4b98fa0ce3ad0654633c2",
"name" : "星展銀行",
"openinghours" : {
"opennow" : false,
"weekdaytext" : []
},
"placeid" : "ChIJex4xo49aTQRuHMhLV-kDc",
"reference" : "CmRfAAAA0uofNZht6utbASwNmEpMxu39xdoEd9eU65BTDVCoNvbBBsPbYfyZYddBB3cB8PmTGKbJNRXXDu1AdTQorDhjpDKKbJdNHCGlqjx5LKd3RtLTM7ERbuhi-mvCIZTIHrIEhCtERO5biWmTqLdpx-047gDGhT-5qgakVk9fx9sjlRZUfOKpYCZIg",
"scope" : "GOOGLE",
"types" : [ "bank", "finance", "establishment" ],
"vicinity" : "西屯區台中港路二段60之8號"
},
{
"geometry" : {
"location" : {
"lat" : 24.147987,
"lng" : 120.669588
}
},
"icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/genericbusiness-71.png",
"id" : "e9adb41f5c16918b9ea7c9e198b5058b5484ff6f",
"name" : "星展銀行",
"openinghours" : {
"opennow" : false,
"weekdaytext" : []
},
"placeid" : "ChIJv2OHQ9aTQRknnvtT9f1us",
"reference" : "CmRgAAAAt01TuRucNuYv88xttZlznmXKEHfFrdlanQZwkPrjcrVivtumLny9flPaZNy4YF366QsafHJWppMwUTx8bIMgvNrBOpbTTnmeOjLA8oKi4bFuhKq4xHXvYHHufTzjEEhCdP4J1C2m4S4aSfdqY9gbPGhQWkuEgceFvbqhBLyLM5qKBB2uoWw",
"scope" : "GOOGLE",
"types" : [ "bank", "finance", "establishment" ],
"vicinity" : "西區民權路219號"
},
...
...
{
"geometry" : {
"location" : {
"lat" : 24.139748,
"lng" : 120.677998
}
},
"icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/genericbusiness-71.png",
"id" : "ae07416012e09331be83ffbab77779628e0fecc8",
"name" : "花旗(台灣)商業銀行ATM",
"openinghours" : {
"opennow" : false,
"weekdaytext" : []
},
"placeid" : "ChIJq39fRI9aTQR1M2sdNU3nM",
"reference" : "CnRwAAAA7GlK9vwBW-myUnXTnB2Tv-V5XJVHJQx91CE95VPiS5OJ5ayyCjD4g1x3yiLJcW-1v1bbOaABMXEJHycbXXSKoKzfIjoLlwXIl7l-aEg8-zjOlwjBliaCHsbImHFcJkcunjDhiwjiKhYS3qAiGYhIQDXjcoIVkaEaTsAwmVTRWdBoURb7EUTY-oV9ZCqc3iOvmcwSH9jU",
"scope" : "GOOGLE",
"types" : [ "atm", "bank", "finance", "establishment" ],
"vicinity" : "中區民權路102號"
}
],
"status" : "OK"
}
(2) keyword:
送出 https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=座標&radius=搜尋範圍&keyword=關鍵字&sensor=true&key=server api key
範例://呼叫 https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=24.1674116,120.6679557&radius=5000&keyword=自行車道&sensor=true&key=AIzaSyC
9nSWENfNXaPrQ9pMFtvxL5NSwbpMiEE
//回傳 { "htmlattributions" : [], "results" : [ { "geometry" : { "location" : { "lat" : 24.136734, "lng" : 120.697396 } }, "icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/generic
business-71.png", "id" : "74d4245ed61187f907175744fe5dc6f7c8a4830c", "name" : "東光園道自行車道", "photos" : [ { "height" : 460, "htmlattributions" : [ "\u003ca href=\"https://plus.google.com/102113594474011668675\"\u003e林老頭\u003c/a\u003e" ], "photoreference" : "CuQB1wAAAGcJIdgm3ornEg
oy9apsL7UjHTcOEYYIqn1cK55YGn4fajRwP4kKBr25PWm5e9RCKx9HEv0kg4gpTljSJAREsTIh9lOMuOjBxI6aQBP6vmUvaAVUXqfXrHHXoVG2BypVOqAeOYzg3sH1cWa3TM7HrbOUvwJ7VsnGSqMSgiIyrwzUYu-nTdUrGKGPMEeSC5i2eKs9PZhdaovZwogMrlr25yfEUH2C15jXkFtCikTHH7W-U6JYOicwAsHIqNPHqlpw-JuuOReGzxP1dt8rd-frUXqhFgYQR1X7k1KeiMYcEhCWlvdamFzPz0eQxPFkZcDwGhQ20ycIsDLytFbMsGshU4N-SCvNPw", "width" : 816 } ], "placeid" : "ChIJgfDC9Dg9aTQRyJmwVbF12E", "rating" : 3.8, "reference" : "CnRrAAAA8rDOWN4IVcqYfzLmpU4lKFFLTCXo339Cm6rC1wg7kAgrS8SpDdeZudwNqkBRzgGs-NqbNm5SZKMnfjzn49ZPYlaUw53Kq-T3WVs466PTKJ51Ia1O91iDrJq5SF1lIvAm
vCwqBIb3BIC5UFVdBhIQE4XQTI07iOK2lD13zm1ZphoUFT7FDj4Cgk29BaxOgYULua5wgyk",
"scope" : "GOOGLE",
"types" : [ "establishment" ],
"vicinity" : "東區東光園路446之1號"
},
{
"geometry" : {
"location" : {
"lat" : 24.171131,
"lng" : 120.704385
}
},
"icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/genericbusiness-71.png",
"id" : "e4351c405528bfc1085af05445aaa25cedb428ed",
"name" : "旱溪「親水式」自行車道",
"placeid" : "ChIJJxfG4AXaTQRq2DOJE0wrDQ",
"reference" : "CoQBdAAAAHiN0alkLB-3xj8Haqef71asoPLBDS9w-klUH1t1bQceMEl44sYtDG3iETmj97DBRyllHrgLBUYy2Pd66ds30kGs751xNA1FCOQvV6SqAV2tiwoAZ1R5XP1YkfnajraCGD3gXXmXLuQgx26mPvXwYyPwHyIQkFNJRbajsGub0EhDJHlsfFvE81ShEVDuqgzUFGhSy14J6FaRXHZn0rX1ttQFkffkmbg",
"scope" : "GOOGLE",
"types" : [ "establishment" ],
"vicinity" : "台中市北屯區旱溪西路三段"
},
...
...
{
"geometry" : {
"location" : {
"lat" : 24.157597,
"lng" : 120.65739
}
},
"icon" : "http://maps.gstatic.com/mapfiles/placeapi/icons/restaurant-71.png",
"id" : "fd211ebe704db2dc4889e293768a2c98d461d784",
"name" : "燒烤王",
"photos" : [
{
"height" : 1224,
"htmlattributions" : [
"\u003ca href=\"https://plus.google.com/117051252423976960156\"\u003e葵小\u003c/a\u003e"
],
"photoreference" : "CnRoAAAAak-SYbk7I2xCIeNUONEVbjK4DpcxD5Qd4b45skXbLARZ2DrY1Gq2vQDOf7Ygc1Zn2k2ejpUvbc7xrfqBHdwg8tSoK2aPIhj3pRPCipbKPPm9DirAveduwC5fJm0xbgihevYSSCaHaXvsOzVn5ThIQ46Hl6qTeGvOgI8wkRvGN-hoUkuVqKONKwuid4QCeup5pqxgGEk",
"width" : 1632
}
],
"placeid" : "ChIJfYieKps9aTQR7X7CLRNl940",
"rating" : 3.9,
"reference" : "CmRdAAAAj2ixVlTCAPfNZlwSfsfIS1Sh1n-5Pj6nyCGYqe5ruArp9lYPS-neb0UOnMeG0WBlKIHdDNW84eUht3KXIKyliRuqRWgcrfstRghXwNT-sqg5QSug3mMyqAnEcUxhEhA0T0qNLxjHmiyc1BgwbUchGhQDJw8fYPLzbjcpHex2ESjQu-V4A",
"scope" : "GOOGLE",
"types" : [ "restaurant", "food", "establishment" ],
"vicinity" : "西屯區精誠路8號"
}
],
"status" : "OK"
}