Calculate BBOX values for wfs request using google map

Here’s my request url looks like{instanceid}?REQUEST=GetFeature&TYPENAMES=S2.TILE&OUTPUTFORMAT=application/json&BBOX={bbox}&TIME={startdate}/{enddate}

how can i calculate BBOX parameter value based on location of google map which is visible on screen?

Does perhaps this entry answer yohr question?

are those coordinates used as BBOX parameters got from map.getBounds() for above request url? or they need some more calculations?

You will need some additional processing to get the BBOX for the WFS reqest.

The map.getBounds() will return a LatLngBounds object of the Google Map extent.
See docs:

Then to convert it to a bbox string for the WFS request

    var gmapbbox = map.getBounds();
    var sw = gmapbbox.getSouthWest();
    var ne = gmapbbox.getNorthEast();
    var wfsbbox = [sw.lng(),, ne.lng(),].join();  // returns a string for the WFS request bbox

Thanks for the tip, but when i passed wfsbbox into request url it returns null
“type”: “FeatureCollection”,
“features”: [
url :{instanceid}?REQUEST=GetFeature&TYPENAMES=S2.TILE&OUTPUTFORMAT=application/json&BBOX=32.12910946979878,29.506358933448496,37.57283505573628,32.56051902785952&TIME=2018-08-01/2018-08-31

You will also need to specify the SRS/CRS parameter for EPSG 4326 (geographic coordinates) as part of the WFS request.

Thank you so much, it works.

I need to know how EO Browser fetch those data and highlight the dates on calendar? as the one i get differs from EO Browser.


EO Browser is open source, so you can find the exact code on GitHub.
If I am not mistaken, this part is dealing with dates: