Skip to content

No results are returned when using format: "geocodejson" #361

@kendlbat

Description

@kendlbat

We would like to use the following geocoder:

var nominatim = L.Control.Geocoder.nominatim({
    reverseQueryParams: {
        format: "geocodejson",
        addressdetails: 1,
        "accept-language": "de-AT,de-DE",
    },
    geocodingQueryParams: {
        countrycodes: "at",
        "accept-language": "de-AT,de-DE",
    },
});

But when doing a reverse geocode lookup, an empty array is returned due to the following if-statement (this is minified JS so not very helpful):
image

The chain of failures is the following:

  • NominatimResult (defined here) is incorrect and does not account for different format flags being used, which further leads to incorrect expectations about the data returned by Nominatim.
  • reverse (defined here) incorrectly assumes that lat and lon are present in the returned data and returns an empty array instead of a) useful error information or b) data.

image

My suggestions are:

  • Correct this behaviour and return the expected result in the "geocodejson"-format. (Recommended)
  • Document this incorrect and unexpected behaviour and alter the L.Control.Geocoder.nominatim options to respond with an error when trying to pass the "geocodejson" format.

Update:
The response from nominatim when using the "geocodejson"-format looks like the following:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions