jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.47k stars 359 forks source link

Create ML dataset using OSM #1203

Closed galleon closed 1 month ago

galleon commented 1 month ago

Hi there, Thanks for your amazing work ... I am a multi year on/off user of ipyleaflet but still have some questions !

I am looking at build a CV dataset from OSM and a specific basemap (geoportail) - yes I am French ;-). I am using overpy to extract geojson data. My goal is to create a set of tuple (images, masks, all having the same distance to pixel ratio). My first idea was to use ipyleaflet and ipywebrtc to save the image but I am not sure ipywebrtc is maintained nor compatible with the latest version of ipyleaflet. I turned to selenium which is working fine but I think it is very difficult to maintain this distance/pixel ratio and it simply seems not to be the proper way to do it. I also read about geemaps which seems a nice tool with plenty of example. But before jumping on a new tool, I wanted to take the advice of the community because there is may be a better suited tool to extract and save an image (expressed as a bbox in lat/lon) with a given pixel/distance ratio

Thanks for your advices

giswqs commented 1 month ago

Would this work for you? https://leafmap.org/notebooks/74_map_tiles_to_geotiff/

galleon commented 1 month ago

Thanks @giswqs this looks interesting. I did few tests on colab but need to install it on my Mac (probably need to install GDAL using brew …) I guess I can choose my base map using ipywidget parameter basemap.

i am still unclear how to transform one point in (lat, Lon) space to its pixel space coordinate? Also do we have a pixel size (in cm) for a given zoom level?

galleon commented 1 month ago

Thanks ! manage to build this with leafmap and rasterio :-)