0

Does reverse geocoding require cellular/wifi? I'm using the following code to find the name of the city and the zip code. Will this code work in an environment with a GPS connection but without cellular connection?

   geoCoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in
        print("REVERSE COMPLETED")
        // Place details
        var placeMark: CLPlacemark!
        placeMark = placemarks?[0]

        // Address dictionary
        print(placeMark.addressDictionary)

        // City
        if let city = placeMark.addressDictionary!["City"] as? NSString {
            print("You are in \(city)")
        } else {
            print("An error occured while fetching the CITY.")
        }

        // Zip code
        if let zip = placeMark.addressDictionary!["ZIP"] as? NSString {
            print("The zip code is \(zip)")
        } else {
            print("An error occured while fetching the ZIP code.")
        }
    })
nhgrif
  • 61,578
  • 25
  • 134
  • 173
Albert Ghar
  • 428
  • 1
  • 6
  • 14
  • GPS gives you lat/long etc. It doesn't give you political boundaries. – Dave Newton Jul 27 '16 at 22:45
  • It's not "Swift Reverse geocoding". The geocoding and reverse geocoding have nothing to do with Swift. – nhgrif Jul 27 '16 at 23:41
  • @nhgrif, please don't edit my answers for things that are stylistic. You removed my comment about the question to being swift-related, and then added almost exactly the same thing as a comment. – Duncan C Jul 27 '16 at 23:58
  • I added the comment and cleaned the mud out of the question. Then I scrolled down, read the answer, and cleaned the irrelevant mud out if it. But thanks for adding it back. It has nothing to do with the question and you clearly understand that, but showing off that you know that is definitely more important than keeping Stack Overflow questions & answers clear, concise, and on point. You can confirm this by looking at timestamps. The comment is 3 minutes older than the edit. – nhgrif Jul 27 '16 at 23:59

1 Answers1

0

Yes, geocoding and reverse geocoding both require an Internet connection. If you're going to do it locally you need GIS software and a large geographic database containing the geography of the area in which you're geocoding.

The software and the databases are both big and expensive. I don't know of GIS software for mobile devices - from mobile it's all done on the cloud.

The only thing you can do on iOS with a GPS but no internet is collect lat/long positions.

BTW, this has nothing to do with Swift. The location manager is part of iOS and callable from any supported language. It's not "Swift geocoding." It's iOS Core Location geocoding.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
  • The last paragraph is completely irrelevant and unrelated to the question. I attempted editing to clean up the answer to make it more clear, but if you insist on fluff, so be it. – nhgrif Jul 28 '16 at 00:00
  • "Completely irrelevant", and yet you posted almost the same thing as a comment. Don't make editorial judgements about other people's posts. – Duncan C Jul 28 '16 at 00:08
  • There's a clear difference between comments and answers. My comment to the question was to explain my edit to the asker (to hopefully avoid them reverting the edit as you did). At the end of the day, the point is... Stack Overflow isn't a forum. It's not social media. People use this site as a resource for doing real work, and fluff gets in the way. – nhgrif Jul 28 '16 at 00:12