Skip to content

Bug: Geoapify results without bounding box error #427

@angiecaves

Description

@angiecaves

When using Geoapify as the provider, sometimes results don't have bounds and this throws an error when loading search results. The last two results of this call do not have bounds:

https://api.geoapify.com/v1/geocode/search?text=60%20W%20Walton&limit=5&filter=rect:-88.263641,41.4697052,-87.110525,42.1542933&format=json&apiKey=YOUR_API_KEY

Sample code using Geoapify:

import { GeoapifyProvider } from 'leaflet-geosearch';

const map = L.map('map').setView([41.830, -97.665], 13);

L.tileLayer('//tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);

const provider = new GeoapifyProvider({
  params:{
    apiKey: YOUR_API_KEY
    filter:'rect:-88.263641,41.4697052,-87.110525,42.1542933',
  }
});

const search = new GeoSearch.GeoSearchControl({
  provider: provider,
});

map.addControl(search);

The following error appears in the console when this search is made:

Image

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions