{"id":794,"date":"2017-01-12T07:18:31","date_gmt":"2017-01-11T22:18:31","guid":{"rendered":"http:\/\/blue-bear.jp\/kb\/?p=794"},"modified":"2017-01-12T07:28:53","modified_gmt":"2017-01-11T22:28:53","slug":"swift-clgeocoder%e3%81%ae%e9%80%86geo%e3%82%b3%e3%83%bc%e3%83%87%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%a7%e4%bd%8d%e7%bd%ae%e5%ba%a7%e6%a8%99%e3%81%8b%e3%82%89%e4%bd%8f%e6%89%80%e7%ad%89%e3%81%ae","status":"publish","type":"post","link":"https:\/\/blue-bear.jp\/kb\/swift-clgeocoder%e3%81%ae%e9%80%86geo%e3%82%b3%e3%83%bc%e3%83%87%e3%82%a3%e3%83%b3%e3%82%b0%e3%81%a7%e4%bd%8d%e7%bd%ae%e5%ba%a7%e6%a8%99%e3%81%8b%e3%82%89%e4%bd%8f%e6%89%80%e7%ad%89%e3%81%ae\/","title":{"rendered":"[swift] CLGeocoder\u306e\u9006Geo\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u4f4d\u7f6e\u5ea7\u6a19\u304b\u3089\u4f4f\u6240\u7b49\u306e\u60c5\u5831\u53d6\u5f97"},"content":{"rendered":"<h2>CLGeocoder\u306e\u9006Geo\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u4f4d\u7f6e\u5ea7\u6a19\u304b\u3089\u4f4f\u6240\u7b49\u306e\u60c5\u5831\u53d6\u5f97<\/h2>\n<p>CLGeocoder().reverseGeocodeLocation\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u6307\u5b9a\u306e\u4f4d\u7f6e\u5ea7\u6a19\u304b\u3089\u4f4f\u6240\u3084\u56fd\u540d\u306a\u3069\u306e\u5730\u7406\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b<\/p>\n<p>\u8fd4\u3055\u308c\u308b\u60c5\u5831\u306f\u30c7\u30d0\u30a4\u30b9\u306e\u8a00\u8a9e\u306b\u4f9d\u5b58\u3059\u308b\u69d8\u5b50<\/p>\n<p>\u30b7\u30e5\u30df\u30ec\u30fc\u30bf\u306f\u82f1\u8a9e\u4ed5\u69d8\u3060\u3063\u305f\u306e\u3067\u3001\u82f1\u8a9e\u3067\u8fd4\u3063\u3066\u304f\u308b<\/p>\n<h3>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\uff1a<\/h3>\n<p>AppDelegate<\/p>\n<pre>\r\n    func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {\r\n        getPlaceMarks(locations)\r\n    }\r\n\r\n    func displayLocationInfo(placemark: CLPlacemark){\r\n        \r\n        print(\"location is \\(placemark.location)\")\r\n        print(\"addressDictionary is \\(placemark.addressDictionary)\")\r\n        print(\"ISOcountryCode is \\(placemark.ISOcountryCode)\")\r\n        print(\"country is \\(placemark.country)\")\r\n        print(\"postalCode is \\(placemark.postalCode)\")\r\n        print(\"administrativeArea is \\(placemark.administrativeArea)\")\r\n        print(\"subAdministrativeArea is \\(placemark.subAdministrativeArea)\")\r\n        print(\"locality is \\(placemark.locality)\")\r\n        print(\"subLocality is \\(placemark.subLocality)\")\r\n        print(\"thoroughfare is \\(placemark.thoroughfare)\")\r\n        print(\"subThoroughfare is \\(placemark.subThoroughfare)\")\r\n        print(\"region is \\(placemark.region)\")\r\n        print(\"timeZone is \\(placemark.timeZone)\")\r\n        print(\"inlandWater is \\(placemark.inlandWater)\")\r\n        print(\"ocean is \\(placemark.ocean)\")\r\n        print(\"areasOfInterest is \\(placemark.areasOfInterest)\")\r\n        \r\n    }\r\n    \r\n    func getPlaceMarks(location: CLLocation){\r\n        CLGeocoder().reverseGeocodeLocation(location, completionHandler: {(placemarks, error)->Void in\r\n            if error != nil {\r\n                print(error!.localizedDescription)\r\n                return\r\n            }\r\n            if placemarks!.count > 0 {\r\n                let placemark = placemarks![0] as CLPlacemark\r\n                self.displayLocationInfo(placemark)\r\n                \r\n            } else {\r\n                print(\"error\")\r\n            }\r\n        })\r\n    }\r\n<\/pre>\n<h3>\u8981\u7d20\u306e\u8a73\u7d30<\/h3>\n<p>\u305d\u308c\u305e\u308c\u306e\u8981\u7d20\u306e\u8a73\u7d30\u306f\u4ee5\u4e0b\u306e\u901a\u308a<\/p>\n<p>location\uff1a\u3000\u53d6\u5f97\u3057\u305fCLLocation<\/p>\n<p>addressDictionary :[NSObject:AnyObject]\u578b\u3067\u4e00\u9023\u306e\u4f4f\u6240\u7b49\u306e\u60c5\u5831\u304c\u8fd4\u3063\u3066\u304f\u308b\u3001\u9023\u7d50\u3057\u305f\u4f4f\u6240\u3082\u8fd4\u3063\u3066\u304f\u308b\u69d8\u5b50<\/p>\n<p>ISOcountryCode \uff1a\u7701\u7565\u3055\u308c\u305f\u56fd\u540d<\/p>\n<p>country \uff1a\u56fd\u540d<\/p>\n<p>postalCode \uff1a\u90f5\u4fbf\u756a\u53f7<\/p>\n<p>administrativeArea \uff1a\u5dde\u540d<\/p>\n<p>subAdministrativeArea \uff1a\u5dde\u306e\u8ffd\u52a0\u60c5\u5831<\/p>\n<p>locality \uff1a\u90fd\u5e02\u540d<\/p>\n<p>subLocality \uff1a\u90fd\u5e02\u306e\u8ffd\u52a0\u60c5\u5831<\/p>\n<p>thoroughfare \uff1a\u901a\u308a\u540d<\/p>\n<p>subThoroughfare \uff1a\u901a\u308a\u306e\u8ffd\u52a0\u60c5\u5831<\/p>\n<p>region \uff1aCLRegion\u578b\u3067\u8fd4\u3063\u3066\u304f\u308b\u9818\u57df\u60c5\u5831<\/p>\n<p>timeZone \uff1aTimeZone\u578b\u3067\u8fd4\u3063\u3066\u304f\u308b\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u60c5\u5831<\/p>\n<p>inlandWater \uff1a\u516c\u5f0f\u30da\u30fc\u30b8\u306b\u306f\u300cinland water body\uff08\u5185\u9762\u6c34\uff09\u300d\u3068\u3042\u3063\u305f\u304c\u6e56\u3084\u5ddd\uff1f<\/p>\n<p>ocean \uff1a\u6d77\u540d<\/p>\n<p>areasOfInterest \uff1a\u8457\u540d\u306aLandMark\u306e\u3088\u3046<\/p>\n<h3>\u30b7\u30e5\u30df\u30ec\u30fc\u30bf\u3067\u306e\u7d50\u679c\uff1a<\/h3>\n<p>\uff0a\u4f4d\u7f6e\u60c5\u5831\u306fApple\u672c\u793e<\/p>\n<pre>\r\nlocation is Optional(<+37.33004350,-122.02647140> +\/- 100.00m (speed -1.00 mps \/ course -1.00) @ 1\/12\/17, 7:07:57 AM Japan Standard Time)\r\n\r\naddressDictionary is Optional([SubAdministrativeArea: Santa Clara, CountryCode: US, Street: 20204 Merritt Dr, State: CA, ZIP: 95014, Name: 20204 Merritt Dr, Thoroughfare: Merritt Dr, FormattedAddressLines: <__NSArrayM 0x60000024be80>(\r\n20204 Merritt Dr,\r\nCupertino, CA  95014,\r\nUnited States\r\n)\r\n, SubThoroughfare: 20204, PostCodeExtension: 2011, Country: United States, City: Cupertino])\r\n\r\nISOcountryCode is Optional(\"US\")\r\n\r\ncountry is Optional(\"United States\")\r\n\r\npostalCode is Optional(\"95014\")\r\n\r\nadministrativeArea is Optional(\"CA\")\r\n\r\nsubAdministrativeArea is Optional(\"Santa Clara\")\r\n\r\nlocality is Optional(\"Cupertino\")\r\n\r\nsubLocality is nil\r\n\r\nthoroughfare is Optional(\"Merritt Dr\")\r\n\r\nsubThoroughfare is Optional(\"20204\")\r\n\r\nregion is Optional(CLCircularRegion (identifier:'<+37.33004350,-122.02647140> radius 70.86', center:<+37.33004350,-122.02647140>, radius:70.86m))\r\n\r\ntimeZone is Optional(America\/Los_Angeles (PST) offset -28800)\r\n\r\ninlandWater is nil\r\n\r\nocean is nil\r\n\r\nareasOfInterest is nil\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CLGeocoder\u306e\u9006Geo\u30b3\u30fc\u30c7\u30a3\u30f3<\/p>\n","protected":false},"author":1,"featured_media":795,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[97,96],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/794"}],"collection":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/comments?post=794"}],"version-history":[{"count":4,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/794\/revisions"}],"predecessor-version":[{"id":799,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/posts\/794\/revisions\/799"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media\/795"}],"wp:attachment":[{"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/media?parent=794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/categories?post=794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue-bear.jp\/kb\/wp-json\/wp\/v2\/tags?post=794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}