InseeFrLab / InseeFrLab/satellite-images-preprocess

Create file that associates polygons to filename on the fly

Open
#19 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
1
PR merge metrics
No merged PRs in 30d

Description

```
import s3fs
from pqdm.processes import pqdm

def create_polygon(image: str) -> gpd.GeoDataFrame:

si = get_satellite_image(image, 3)

# Create a polygon from the bounds
minx, miny, maxx, maxy = si.bounds
polygon = Polygon([(minx, miny), (maxx, miny), (maxx, maxy), (minx, maxy)])

# Create a GeoDataFrame with the polygon
gdf = gpd.GeoDataFrame(geometry=[polygon], crs=si.crs)
gdf['filename'] = image

return gdf

fs = s3fs.S3FileSystem(client_kwargs={"endpoint_url": "https://" + "minio.lab.sspcloud.fr"})
list_filename = fs.ls("projet-slums-detection/data-raw/PLEIADES/MAYOTTE/2020/")

result = pqdm(list_filename, create_polygon, n_jobs=50)
merged_gdf = gpd.GeoDataFrame(pd.concat(result, ignore_index=True), crs=result[0].crs)
merged_gdf.to_parquet("filename_to_polygon.parquet")
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the proposed Python entry point create_polygon and inspect how get_satellite_image is defined and used in the repository. Use the issue's S3 listing and filename_to_polygon.parquet output as the scope; done means the polygon-to-filename associations are generated and saved successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.