Hello, this is mu request for getting NDVI filter for the leaflet map, it works. But now I am researching for about 2 months how get this layer only in the bounds of the drawer polygon. I don’t want to set the map bounds in the sentinel hub playground I want to be set dynamically:
This is my code for getting sentinel hub NDVI filter for the whole map:
May I ask which React library you are using? React Leaflet has a WMSTileLayer component, but the props look very different (WMS parameters should be passed through params prop), so I assume you are using something else?
It also seems to me you can also leave urlProcessingApi prop out.
But assuming that the props of this component get translated to query parameters, something like this should work:
Hope it helps - if not, please specify which library the component WMSTileLayer comes from and we’ll try to come up with a better solution.
EDIT: It occured to me that you might be using an older version of React Leaflet, and indeed, the component signature matches. In that case the solution above should work because the props are passed verbatim.
However for the CRS, you should check which one the Leaflet is using. You can do this by clicking on the request in developer tools (which I see in the screenshot you are already using) and checking “CRS” parameter value. Geometry of the polygon must be specified in the same CRS.
You should also be careful about the version parameter. In OGC, the order of coordinates in EPSG:4326 depends on it (see here for explanation).
The matching WMS request (which works, if you put in the whole instance ID) is:
When I draw a polygon I successfully get the coordinates but how can I pass them to the geometry tag, not to be hardcoded…
I can’t really advise how to do that specifically, because it depends on the format of coordinates you have. This prop (geometry) is just a string - you just need to construct it from the coordinates you have.
This is just an example which will probably not work for you, but it gives an idea of how the code would look approximately:
I have the same problem but when I tried the solution you proposed, it didn’t work for me because I am using react-leaflet@4.2.1 so can you help me converting the solution to the version I got ,I tried to convert using chatgpt and also using documentation but I didn’t succeed doing it
Hi, I’m working on a React application where I have a button that loads the NDVI image for a selected polygon field. The API call returns the WMS link for the NDVI image. The issue arises when I include the Geometry parameter in the request. Without it, the code runs fine and returns a square BBOX, but when I add the Geometry parameter alongside the BBOX, I encounter an exception error.