Your Location is: Home > Flutter

Reverse Geocoding in MapBox api not working

From: Syria View: 4732 Wayne Johnson 


Forward geocoding perfectly, now I want to use reverse geocoding and keep getting an Http status error of 422. The reverse geocoding doesn't work in the Mapbox playground either. Any suggestions or reasons for this?

Here is my http request:,-117.15991102159023.json?types=place&access_token=[MAPBOX TOKEN HERE]

Best answer

You have the lat lng reversed.

Performing this request:

curl --location --request GET \

resulted in this response:

    "type": "FeatureCollection",
    "query": [
    "features": [
            "id": "place.11741308809618150",
            "type": "Feature",
            "place_type": [
            "relevance": 1,
            "properties": {
                "wikidata": "Q16552"
            "text": "San Diego",
            "place_name": "San Diego, California, United States",
            "bbox": [
            "center": [
            "geometry": {
                "type": "Point",
                "coordinates": [
            "context": [
                    "id": "region.9697035897738010",
                    "short_code": "US-CA",
                    "wikidata": "Q99",
                    "text": "California"
                    "id": "country.19352517729256050",
                    "short_code": "us",
                    "wikidata": "Q30",
                    "text": "United States"
    "attribution": "NOTICE: © 2020 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service ( This response and the information it contains may not be retained. POI(s) provided by Foursquare."

Another answer

Http 422 error is an unprocessable entity, which means that you have good well-formed request, however semantically it can't be processed - might be related to data used.

422 description:

To fix a 422 Unprocessable Entity error isn't so cut and dry. The resolution path can very much differ for each scenario. However, as described above in the RFC definition of the 422 status, the error occurs when your data is incorrect; or for the lack of better terms, doesn't make logical sense.

Try reviewing your data to verify whether or not you may have incorrectly defined a particular piece of data in your request.

Reference docs

The 422 (Unprocessable Entity) status code means the server understands the content type of the request entity (hence a 415(Unsupported Media Type) status code is inappropriate), and the syntax of the request entity is correct (thus a 400 (Bad Request) status code is inappropriate) but was unable to process the contained instructions.

Are you sure data entered is correct?


Another answer

Found the answer. The reverse coding format takes longitude first, then latitude. Simple fix, but not a common structure for lat/long formatting. It's working fine now that I swapped them in the http request as follows:,32.70972385426521.json?types=place&access_token=[MAPBOX TOKEN HERE]