开发者

How to find location

I am new developer on iPhone. My problem is that I'm finding latitud开发者_JS百科e and longitude using CLLocation. I want find the address using these latitude and longitude.

Please help me.


What you are describing is called reverse geocoding. MapKit has a class called MKReverseGeocoder that does this for you.

You create an instance, initialize it with your coordinates, start it and then wait for a delegate callback which will pass you the address. You can find all the details in the docs.

Hope that helps.


here is straight solution

make a call to

http://api.fwix.com/general/getgeo.json?lat=*****&lon=*****

like

http://api.fwix.com/general/getgeo.json?lat=37.75&lon=-122.68

it will return a json string

{
  "error": 0,
  "result": {
    "id": "1",
    "pretty": "SF Bay Area Metro",
    "lat": "37.7145",
    "lon": "-122.25",
    "short": "sfbay",
    "country": {
      "placeid": "225",
      "pretty": "United States of America",
      "lat": "37.0902",
      "lon": "-95.7129",
      "short": null,
      "abbr": "US",
      "type": "country",
      "item_type": "places",
      "radius": null
    },
    "state": "CA",
    "url": "san+francisco",
    "provinceid": "273",
    "countryid": "225",
    "province": {
      "placeid": "273",
      "pretty": "California",
      "abbr": "CA",
      "lat": "36.7783",
      "lon": "-119.418",
      "countryid": "225",
      "short": "california",
      "title": "California",
      "type": "province",
      "item_type": "places",
      "radius": 800
    }
  }
}

You have to parse this json and get the required data from it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜