简体   繁体   English

使用CLGeocoder获取地名(而不是街道名)

[英]Get place names using CLGeocoder (not street names)

I want to develop my own maps app. 我想开发自己的地图应用。 I have been successful in getting a street address at the point of touch on my iPhone using CLGeocoder . 我已经成功使用CLGeocoder在iPhone上的触摸点获得了街道地址。 Now my question is the following: 现在我的问题是:

  1. I know that you can get information about a place by using a URL like https://maps.google.com/?q=37.324599,-122.031844 我知道您可以通过使用https://maps.google.com/?q=37.324599,-122.031844类的URL来获取有关地点的信息
  2. If you click on the above URL, it will take you near a church in Cupertino. 如果您单击上面的URL,它将带您到库比蒂诺的一座教堂附近。 Now CLGeocoder will only give me its street address ie 10110 N De Anza Blvd Cupertino, CA 95014 (I get this). 现在, CLGeocoder只给我其街道地址,即10110 N De Anza Blvd Cupertino, CA 95014 (我知道了)。 But how to get the actual name ie St Joseph of Cupertino Church and Parish ? 但是,如何获得真实名称St Joseph of Cupertino Church and Parish
  3. We can see it on Google Maps that means they must have it stored somewhere right? 我们可以在Google Maps上看到它,这意味着他们必须将其存储在正确的位置?

Is there any way to access those place names (Not just by CLGeoCoder , any way is fine). 有什么方法可以访问那些地名(不仅仅是CLGeoCoder ,任何方法都可以)。

The GeoCoding API in general is for converting between street addresses and coordinates. 通常,GeoCoding API用于在街道地址和坐标之间进行转换。 If you want place names you can probably use the Places API. 如果需要地名,则可以使用Places API。

(I know this is more of a comment than an answer, but I think I don't have enough reputation points to comment on questions yet) (我知道这更多是评论,而不是答案,但我认为我没有足够的声誉积分来评论问题)

YOu need t odo like this way after getting lat long use this code by CLLocation manager class 您需要更长的时间后,才需要像这样的odo来通过CLLocation管理器类使用此代码

{ {

CLGeocoder *reverseGeo = [[CLGeocoder alloc] init];

[reverseGeo reverseGeocodeLocation: loc completionHandler: 
 ^(NSArray *placemarks, NSError *error) {

     NSLog(@"%@",[placemarks objectAtIndex:0]);
     for (CLPlacemark *placemark in placemarks) {



         NSLog(@"~~~~~~~~%@",placemark.locality);

     }


 }];

} }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM