{"id":338,"date":"2015-06-06T00:31:08","date_gmt":"2015-06-05T16:31:08","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=338"},"modified":"2016-07-15T17:37:32","modified_gmt":"2016-07-15T09:37:32","slug":"%e5%a6%82%e4%bd%95%e8%a7%a3%e5%86%b3%e7%99%be%e5%ba%a6%e5%9c%b0%e5%9b%be%e5%8f%8d%e5%9c%b0%e7%90%86%e7%bc%96%e7%a0%81%e5%a4%b1%e8%b4%a5%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%81%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2015\/06\/06\/003108338.html","title":{"rendered":"\u5982\u4f55\u89e3\u51b3\u767e\u5ea6\u5730\u56fe\u53cd\u5730\u7406\u7f16\u7801\u5931\u8d25\u7684\u95ee\u9898\uff01\uff01"},"content":{"rendered":"<p>\u6211\u4eec\u5728\u4f7f\u7528\u767e\u5ea6\u5730\u56fe\u5b9a\u4f4d\u6210\u529f\u540e\uff0c\u4e00\u822c\u4f1a\u4f7f\u7528\u53cd\u5730\u7406\u7f16\u7801\u7684\u65b9\u5f0f\u8fdb\u884c\u5730\u5740\u89e3\u6790\uff0c\u83b7\u53d6\u5730\u5740\u4fe1\u606f\u4f9b\u6211\u4eec\u5e94\u7528\u4f7f\u7528\uff0c\u5982\u4e0b\u65b9\u6cd5\u6240\u793a\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/ \u83b7\u53d6\u5730\u5740\u4f4d\u7f6e\u540e\u8c03\u7528\u65b9\u6cd5\n- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation\n{\n\/*\n????code for location...\n?*\/\n????????\/\/ \u53cd\u5730\u5740\u7f16\u7801\u83b7\u53d6\u5730\u5740\n????????BMKReverseGeoCodeOption *option = [[BMKReverseGeoCodeOption alloc] init];\n????????option.reverseGeoPoint = userLocation.location.coordinate;\n?????????\n????????SALog(@\"\u5f00\u59cb\u53cd\u5730\u7406\u7f16\u7801...\");\n?????????\n????????if (![self.geoCode reverseGeoCode:option]){\n????????????SALog(@\"\u53cd\u5730\u5740\u7f16\u7801\u5931\u8d25\uff0c\u4f7f\u7528Apple\u5730\u56fe\u53cd\u5730\u7406\u7f16\u7801\");\n????????????CLLocationCoordinate2D newCoor = [[self class] GCJ02FromBD09:userLocation.location.coordinate];\n????????????CLLocation *location = [[CLLocation alloc] initWithLatitude:newCoor.latitude longitude:newCoor.longitude];\n????????????[[[CLGeocoder alloc] init] reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {\n????????????????CLPlacemark *placemark = [placemarks firstObject];\n????????????????SALog(@\"%@ - %@\", placemark.name, placemark.locality);\n\/*\n????code for address...\n?*\/\n????????????}];\n????????}\n????????\/\/ \u7ed3\u675f\n????}\n}<\/pre>\n<p><!--more--><br \/>\n\u4f46\u662f\uff0cApple\u7684\u53cd\u5730\u5740\u7f16\u7801\u4f7f\u7528\u7684\u7ecf\u7eac\u5ea6\u4e0e\u767e\u5ea6\u7ecf\u7eac\u5ea6\u5750\u6807\u662f\u4e0d\u4e00\u81f4\u7684\uff0c\u6240\u4ee5\u9700\u8981\u8f6c\u6362\uff0c\u8fd9\u91cc\u7ed9\u4e00\u4e2a\u8f6c\u6362\u7684\u65b9\u6cd5\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/\/ \u767e\u5ea6\u5750\u6807\u8f6c\u9ad8\u5fb7\u5750\u6807\n+ (CLLocationCoordinate2D)GCJ02FromBD09:(CLLocationCoordinate2D)coor\n{\n????CLLocationDegrees x_pi = 3.14159265358979324 * 3000.0 \/ 180.0;\n????CLLocationDegrees x = coor.longitude - 0.0065, y = coor.latitude - 0.006;\n????CLLocationDegrees z = sqrt(x * x + y * y) - 0.00002 * sin(y * x_pi);\n????CLLocationDegrees theta = atan2(y, x) - 0.000003 * cos(x * x_pi);\n????CLLocationDegrees gg_lon = z * cos(theta);\n????CLLocationDegrees gg_lat = z * sin(theta);\n????return CLLocationCoordinate2DMake(gg_lat, gg_lon);\n}<\/pre>\n<p>\u5173\u4e8e\u767e\u5ea6\u5730\u56fe\u7ecf\u7eac\u5ea6\u4e0e\u82f9\u679c\u81ea\u5e26\u5730\u56fe\u7ecf\u7eac\u7684\u6545\u4e8b\uff0c\u8bf7\u53c2\u8003:<a href=\"http:\/\/www.yusian.com\/blog\/project\/2015\/04\/27\/105101.html\" target=\"_blank\">\u767e\u5ea6\u5730\u56fe\u7ecf\u7eac\u5ea6\u4e0e\u82f9\u679c\u5730\u56fe\u7ecf\u7eac\u5ea6\u4e4b\u95f4\u7684\u8f6c\u6362<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u5728\u4f7f\u7528\u767e\u5ea6\u5730\u56fe\u5b9a\u4f4d\u6210\u529f\u540e\uff0c\u4e00\u822c\u4f1a\u4f7f\u7528\u53cd\u5730\u7406\u7f16\u7801\u7684\u65b9\u5f0f\u8fdb\u884c\u5730\u5740\u89e3\u6790\uff0c\u83b7\u53d6\u5730\u5740\u4fe1\u606f\u4f9b\u6211\u4eec\u5e94\u7528\u4f7f\u7528\uff0c\u5982\u4e0b\u65b9\u6cd5\u6240\u793a\uff1a \/\/ \u83b7\u53d6\u5730\u5740\u4f4d\u7f6e\u540e\u8c03\u7528\u65b9\u6cd5 &#8211; (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation { \/* ????code for location&#8230; ?*\/ ????????\/\/ \u53cd\u5730\u5740\u7f16\u7801\u83b7\u53d6\u5730\u5740 ????????BMKReverseGeoCodeOption *option = [[BMKReverseGeoCodeOption alloc] init]; ????????option.reverseGeoPoint = userLocation.location.coordinate; ????????? ????????SALog(@&#8221;\u5f00\u59cb\u53cd\u5730\u7406\u7f16\u7801&#8230;&#8221;); ????????? ????????if (![self.geoCode reverseGeoCode:option]){ ????????????SALog(@&#8221;\u53cd\u5730\u5740\u7f16\u7801\u5931\u8d25\uff0c\u4f7f\u7528Apple\u5730\u56fe\u53cd\u5730\u7406\u7f16\u7801&#8221;); ????????????CLLocationCoordinate2D newCoor = [[self class] GCJ02FromBD09:userLocation.location.coordinate]; ????????????CLLocation *location = [[CLLocation alloc] initWithLatitude:newCoor.latitude longitude:newCoor.longitude]; ????????????[[[CLGeocoder alloc] init] reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) { ????????????????CLPlacemark *placemark = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[13,17],"class_list":["post-338","post","type-post","status-publish","format-standard","hentry","category-project","tag-bdmap","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=338"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/338\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}