wri / gfw_forest_loss_geotrellis

Global Tree Cover Loss Analysis using Geotrellis and SPARK
MIT License
10 stars 8 forks source link

GTC-2859 GPV-3183 Compute centroid for dashboard locations before 1x1 splitting #236

Closed danscales closed 4 months ago

danscales commented 4 months ago

GTC-2859 GPV-3183 Compute centroid for dashboard locations before 1x1 splitting

We currently compute the centroid of GFWPro locations (locId != -1) after we do 1x1 splitting. This means that if a location (locId != -1) is split into two or more pieces, then we will compute centroids for each piece of the location, and therefore may have two or more rows for the location with different GADM ids. This is not correct - we want only one row per location, with a single GADM id based on the centroid of the overall location. As far as I can tell, this bug has existed since the beginning of the dashboard analysis.

To fix, I added an optional arg to ValidatedFeatureRDD() to specify that the centroid of locations should be computed and added to their FeatureId before any location is split up. This flag is only set for the GFWProDashboard analysis, which then uses the pre-computed centroid in the FeatureId.

danscales commented 4 months ago

Thanks for the review!