Skip to content

Instantly share code, notes, and snippets.

{'html_attributions': [], 'status': 'OK', 'results': [{'place_id': 'ChIJSTLZ6barQjQR7OeldE1QDsU', 'id': '09bd306d8a6fff4ed4920a843bfffb77405c4dbc', 'reference': 'CmRSAAAAbulvhVx0YEexX2M3Fi3BtxLea2U8_7Ruq1HnivcsnhQfnbur1TxVfdKCFSICFQeUyoOsGnvZLDHHHzNaP7QN__fJ4LL9WNdqW2pRPRhqsUKG8ZAKYm7puNkundjgFlPTEhARhMUPDUPBbAqDYGP6G3ddGhSaoLSfPYT4cLtjcxW72QReaX93yw', 'geometry': {'location': {'lng': 121.5651166, 'lat': 25.0338119}}}, {'place_id': 'ChIJraeA2rarQjQRcsQVAszSNog', 'id': '24711f6d1d5600fb77e7fe680d251776da27bc56', 'reference': 'CmRSAAAACT67OQqRIlpQmduE4RAFWcqxSXhEbt3gZO4SYGTwLpKbZXZu30OBpb4C8D5ncJwDtMsE13xuEIqDAqAayuIOfRQSzDq3hFmdKnaWsKSI62s7LtEQSfCs1TXQO6OxehaVEhDG_WnFgjmK8QwaV_v8ZaDvGhSghBE7BlQ14yWAwQvaGYZy3oXriA', 'geometry': {'location': {'lng': 121.56481, 'lat': 25.033718}}}, {'place_id': 'ChIJSTLZ6barQjQRDNycA51cBq4', 'id': 'cdff9d8fc20ef48d0f10f3227e890d97ed3c8ce2', 'reference': 'CmRSAAAAm1FvUZQ0fWLwYXD4COXlRNfNS3KJqs9B7AdMbjthAfy0aHB6fut6Uf8MbLd9vpQoTlLr0JznkXjMRVQoMiGarDO-GHEh4DLAGOs66F8F5L5g6DU-_TgliEg
@hehehaha0228
hehehaha0228 / google_map_api_radar_search.py
Last active April 30, 2018 08:43
python使用Googoe Map API雷達搜尋功能
import googlemaps
google_key = “xxx”
gmaps = googlemaps.Client(key = google_key)
radar_results = gmaps.places_radar(location = (25.034195, 121.564467), radius = 100, type = “cafe”)
print(radar_results)
import UIKit
class ViewController: UIViewController {
@IBAction func unwind(segue: UIStoryboardSegue){
if segue.identifier == "goToSeconViewController" {
segue.source as! SecondViewController
}
}
import UIKit
class SecondViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
print("2ViewDidLoad")
}
override func viewWillAppear(_ animated: Bool) {
print("2ViewWillAppear")
import UIKit
import CoreLocation
import MapKit
class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
let locationManager: CLLocationManager? = CLLocationManager()
@IBOutlet weak var mapView: MKMapView!
import UIKit
import CoreLocation
class TableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, CLLocationManagerDelegate {
var myLocationManager : CLLocationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
//
// ViewController.swift
// myNavegationLayoutAndToolBar
//
// Created by Chang Shu Hao on 2018/5/5.
// Copyright © 2018年 Gary. All rights reserved.
//
import UIKit
import CoreLocation
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
print("A viewDidLoad")
}
radar_results = radar_results['results']
for radar_result in radar_results:
place_id = radar_result['place_id']
#以上取出12個地點的place_id,以下帶入函數place(place_id, language)
detail_results = gmaps.place(place_id, language = "zh-tw")
print(detail_results['result']['name'])