Search code examples
iosswiftmapboxgeocodingmapbox-ios

Does Mapbox Geocoding API iOS reverse geocode on large bodies of water (Oceans)?


I am using Mapbox's Geocoding API on iOS (Swift) to reverse geocode coordinates. I have been able to make it work for any land coords, but when on the ocean my code does not run (or print the placemark):

        let task = geocoder.geocode(options) { (placemarks, attribution, error) in
            guard let placemark = placemarks?.first else { return }

            print(placemark.name)
          }

So is this not supported by the API or is there something I am not seeing, or is there an alternative to this?

I have read their API Documentation and could not find anything...


Solution

  • No, they do not.

    There aren't many API services that reverse geocode in large bodies of water either.

    Here is one: https://geocode.xyz/46.195042,-6.767578?geoit=xml (it should work in both land and water. see https://geocode.xyz/api for full api specification)

    <geodata>
     <error>
     <code>008</code>
     <description>24. Your request did not produce any results.</description>
     </error>
    <suggestion>
     <region>North Atlantic Ocean</region>
     <subregion>French part of the North Atlantic Ocean</subregion>
     <eez>French Exclusive Economic Zone</eez>
     <territory>France</territory>
     <iso>FRA</iso>
     <altname>France</altname>
    <north>
     <city>La Chapelle Bank</city>
     <prov> </prov>
     <distance>163</distance>
     <latt>47.616667</latt>
     <longt>-7.3</longt>
    </north>
    <south>
    <city/>
    <prov> </prov>
    <distance/>
    <latt/>
    <longt/>
    </south>
    </suggestion>
    <geonumber>3147033738852</geonumber>
    <osmtags/>
    </geodata>