1

I am working on a forked OSM/leaflet/overpass API application which has its own max bounds declared

var mapBounds = { south: 50.8025, west: 0.3724, north: 50.8785, east: 0.5290 };
var LBounds = L.latLngBounds([mapBounds.south, mapBounds.west], [mapBounds.north, mapBounds.east]);

followed by

var map = new L.map('map', {
    maxBounds: LBounds.pad(0.5),
    maxBoundsViscosity: 1.0,
    minZoom: 10,
    maxZoom: 20,
...

The query to Overpass API is done via Nominatim

geocoder: L.Control.Geocoder.nominatim({
    geocodingQueryParams: {
        bounded: 1,
        viewbox: [mapBounds.west, mapBounds.south, mapBounds.east, mapBounds.north].join(',')
    }
})

I have set the mapBounds to allow world view

var mapBounds = { south: -90, west: -180, north: 90, east: 180 };

and then do something like

var mapBounds='bbox=' + map.getBounds().toBBoxString();

in order to restrict Overpass API requests to the current viewport only I couldn't make it work yet.

  • And how do your current Overpass API queries look like? – IvanSanchez Jan 24 at 15:05
  • Hi Ivan, it builds the lookup with Nominatim: geocoder: L.Control.Geocoder.nominatim({ geocodingQueryParams: { bounded: 1, viewbox: [mapBounds.west, mapBounds.south, mapBounds.east, mapBounds.north].join(',') } }) – Grashopper Jan 24 at 15:21
  • Please edit your own question to include that information in the question body. – IvanSanchez Jan 24 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.