私はiOS用のGoogleマップAPIを使用しています。私は特別な都市の静的なイメージを取得し、それをUIImageViewに貼り付けたいと思います。どうしたらいいですか?iOSのGoogleマップから静止画像を取得するには
5
A
答えて
8
@Ankitの回答は右ですが、@Alexsanderので、スウィフトに尋ねた:
var staticMapUrl: String = "http://maps.google.com/maps/api/staticmap?markers=color:blue|\(self.staticData.latitude),\(self.staticData.longitude)&\("zoom=13&size=\(2 * Int(mapFrame.size.width))\(2 * Int(mapFrame.size.height))")&sensor=true"
var mapUrl: NSURL = NSURL(string: staticMapUrl.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding))!
var image: UIImage = UIImage.imageWithData(NSData.dataWithContentsOfURL(mapUrl))
var mapImage: UIImageView = UIImageView(frame: mapFrame)
+0
@marocズームを計算する方法:( – user3804063
4
NSString *staticMapUrl = [NSString stringWithFormat:@"http://maps.google.com/maps/api/staticmap?markers=color:blue|%@,%@&%@&sensor=true",self.staticData.latitude, self.staticData.longitude, [NSString stringWithFormat:@"zoom=13&size=%dx%d",2*(int)mapFrame.size.width, 2*(int)mapFrame.size.height]];
NSURL *mapUrl = [NSURL URLWithString:[staticMapUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:mapUrl]];
UIImageView *mapImage = [[UIImageView alloc] initWithFrame:mapFrame];
これは役に立ちます。
+0
私は都市名を知っています – Alexander
1
Swift 3 =>
let Width = 100
let Height = 200
let mapImageUrl = "https://maps.googleapis.com/maps/api/staticmap?center="
let latlong = "18.495651759752, 73.809987567365"
let mapUrl = mapImageUrl + latlong
let size = "&size=" + "\(Int(Width))" + "x" + "\(Int(Height))"
let positionOnMap = "&markers=size:mid|color:red|" + latlong
let staticImageUrl = mapUrl + size + positionOnMap
if let urlStr : NSString = staticImageUrl.addingPercentEscapes(using:String.Encoding.utf8)! as NSString{
// setImageFromURL
}
1
スウィフト3を使用する:
ここlet lat = ..
let long = ..
let staticMapUrl: String = "http://maps.google.com/maps/api/staticmap?markers=color:red|\(lat),\(long)&\("zoom=13&size=\(2 * Int(cell.imgAddress.frame.size.width))x\(2 * Int(cell.imgAddress.frame.size.height))")&sensor=true"
let url = URL(string: staticMapUrl.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!)
do {
let data = try NSData(contentsOf: url!, options: NSData.ReadingOptions())
cell.imgAddress.image = UIImage(data: data as Data)
} catch {
cell.imgAddress.image = UIImage()
}
+0
ズームを計算する方法:( – user3804063
関連する問題
- 1. iOSのGoogleマップから静的な画像を取得する方法
- 2. iphoneのGoogle静止画像
- 3. Googleマップの画像を取得
- 4. iosで画像からテキストを取得する(画像処理)
- 5. Googleマップから場所の最初の画像を取得できますか?
- 6. Androidスタジオ、Googleから画像を取得
- 7. javascriptを使用してyoutubeのビデオ静止画像を取得するには?
- 8. Googleマップの描画マネージャーポリゴンからGeoJSONを取得する
- 9. SwiftのGoogle画像から画像を取得する方法は?
- 10. Android - GoogleマップからFirebaseに画像をアップロードするには?
- 11. Django Google Cloudストレージから静止画像をレンダリングするための設定
- 12. ピクセルをLatLng座標に変換するgoogle静止画像
- 13. アドレスミスでGoogleマップ画像を取得するC#
- 14. Google画像:サムネイルURLから大きな画像URLを取得
- 15. 変数を静的なGoogle画像マップに渡す
- 16. 静止画像の画像オンロード
- 17. 最初の画像を取得するGoogleからの結果
- 18. リアクション - 静止画像をロード
- 19. 私はGoogleマップは静止画像を取得するためのAPIを提供していることを知っている所定の領域
- 20. Google画像検索から画像URL-sを取得する方法
- 21. IOSのObjective-CアプリでGoogleマップにマーカー画像を追加
- 22. Googleマップのapiから国を取得するには?
- 23. コードでマップされたSPのフォルダから画像を取得
- 24. アップルからこの画像/テキストiOSレイアウトを取得するには?
- 25. 静止画/静止画からQRコードを読む
- 26. iosでアップロードした後にfirebaseからサムネイル画像を取得するには?
- 27. ウェブカメラ「静止ピン」から画像をキャプチャしますか?
- 28. Google画像を取得する方法
- 29. Googleカスタム検索APIから画像のalt-textを取得するには
- 30. GoogleマップAPIから輻輳情報を取得するには
Objecive cのリンクは、あなたができることです試してみてください –
ここに何かがあります.. https://developers.google.com/maps/documentation/static-maps/?hl=ja –