Open javierpose opened 4 years ago
Did you see https://github.com/MatthewBarker/leaflet-wikipedia which actully I stole code from
Although it seems to use gscoord
ratehr than gsbbox
https://github.com/MatthewBarker/leaflet-wikipedia/blob/master/source/leaflet-wikipedia.js
origin = this._map.getCenter(),
data = {
format: 'json',
action: 'query',
list: 'geosearch',
gslimit: this.options.limit,
gsradius: this.getRadius(),
gscoord: origin.lat + '|' + origin.lng
},
But should be able to do something similar.
In Geographs case, I had the Geograph Server understand the 'standard' BBOX string
var bounds = map.getBounds();
this._sentBounds = bounds.toBBoxString();
You can 'compose' a string manually with the bounds. https://leafletjs.com/reference-1.3.4.html#latlngbounds
/// Bounding box to search in: pipe (|) separated coordinates of top left and bottom right corners.
gsbbox = bounds.getNorth() + '|' + bounds.getWest() + '|' + bounds.getSouth() + '|' + bounds.getEast();
I tried to modify the plugin to make it work with wikimedia common but the bounds have given me problems https://commons.wikimedia.org/wiki/Special:ApiSandbox#action=query&list=geosearch&gsbbox=37.8|-122.3|37.7|-122.4 Some ideas? Thanks