4

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...

  • No. How could it? Inspect the response and will find a very low confidence since there are no addresses in the middle of bodies of water – charlietfl Jul 01 '19 at 22:10
  • @charlietfl there is no response. So is there no way to find out if a coordinate is in the Pacific Ocean, for example, using the Mapbox Geocoding? –  Jul 01 '19 at 23:20

1 Answers1

1

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>
Ervin Ruci
  • 829
  • 6
  • 10
  • Correct. I emailed the support team and told me that they do not handle queries on oceans that are not administrative entities. –  Jul 03 '19 at 03:26