How to calculate statistics on NDVI images for multypoligons

  • 26 April 2024
  • 6 replies
  • 22 views

Hi, I would like to calculate the statistical data from multypoligon (kml) for separate. When I upload the kml with multipolygon it’s making the graph with the full and unique image. Its is possible?
Thanks ,

Laia


6 replies

Dear Laia,

if I understand you correctly you are using EO Browser and want to get statistics (NDVI mean, max…) for each of the polygons in a multipolygon-kml?!

This is unfortunately not possible. You will always get only one statistic for the whole AOI returned (there is a small issue currently in EO Browser which will be resolved soon leading to only returning statistics for the first polygon of the multipolygon)

A simple workaround would be to create a small script that splits your multipolygon into single polygons and then requests statistics for each of them using our Statistical API.

Best,
Daniel

Thanks, Daniel ! I will try it !

dthiex:

(there is a small issue currently in EO Browser which will be resolved soon leading to only returning statistics for the first polygon of the multipolygon

With the latest deploy of EO Browser to v3.4.0 now the correct statistic for the whole multipolygon is returned.

Hi dthiex, i have the same problem but with python API. I try get in the same request:

  • A True color image in a bounding box.
  • NDVI values in a multiple polygons in same bounding box.

I try create this script in python using sentinelHubRequest, but only obtain a one polygon, using with this guide.

Hi @santiagoperaza

Could you please clarify if your issue is with StatisticalAPI or with ProcessAPI?

Using the following snippet:

req = SentinelHubRequest(
    evalscript=escript, 
    input_data = [SentinelHubRequest.input_data(
        data_collection=DataCollection.SENTINEL2_L1C,
        time_interval=['2021-01-01','2021-02-01'],
        maxcc=0.2)],
    responses = [SentinelHubRequest.output_response('default', MimeType.TIFF)],
    geometry=Geometry(aois[aois.index<2].unary_union, CRS.WGS84),
    resolution=(0.0001,0.0001)
)  

creates a multi-polygon geometry (for example purposes I’ve created it by means of unary_union of two polygons) and the response contains both geometries:
multipoly_request

Unfortunately, it is not possible to mix bbox and geometry in single request, so if you want to see true color over bounding box, and then get NDVI values just for some (multi-)polygon inside this bounding box, you’ll have to create two separate requests.

i used ProcessAPI. Your example would work for me,how use unary_union? documentation?

Reply


Planet Monitoring
Investors

© 2024 Planet Labs PBC. All rights reserved.
| Privacy Policy | California Privacy Notice | California Do Not Sell
Your Privacy Choices | Cookie Notice | Terms of Use