Skip to content

Nominatim API returns 404 due to trailing slashes in geocoder endpoints #32

@gebeer

Description

@gebeer

Problem

The bundled Control.Geocoder.js (from leaflet-control-geocoder) uses trailing slashes in the Nominatim API endpoints, which now return 404 errors.

Affected lines in Control.Geocoder.js:

  • Line 343: this.options.serviceUrl + 'search/'
  • Line 370: this.options.serviceUrl + 'reverse/'

Resulting URLs (404):

  • https://nominatim.openstreetmap.org/search/?q=...
  • https://nominatim.openstreetmap.org/reverse/?lat=...

Correct URLs (working):

  • https://nominatim.openstreetmap.org/search?q=...
  • https://nominatim.openstreetmap.org/reverse?lat=...

Solution

Remove the trailing slashes:

- L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search/', L.extend({
+ L.Control.Geocoder.jsonp(this.options.serviceUrl + 'search', L.extend({
- L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse/', L.extend({
+ L.Control.Geocoder.jsonp(this.options.serviceUrl + 'reverse', L.extend({

This aligns with the current upstream library which no longer uses trailing slashes.

Environment

  • ProcessWire 3.x
  • FieldtypeLeafletMapMarker (latest from this repo)
  • Tested in Firefox/Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions