Download utils.py from pawlo2013/EarthLoc2: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/spaces/pawlo2013/EarthLoc2/resolve/main/utils.py
- Command line
-
hf download hf://spaces/pawlo2013/EarthLoc2/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/pawlo2013/EarthLoc2/resolve/main/utils.py
466 Bytes
| from PIL import Image | |
| def get_image_metadata_from_path(path): | |
| if isinstance(path, Path): | |
| return path.name.split("@") | |
| elif isinstance(path, str): | |
| return path.split("@") | |
| def get_footprint_from_path(path): | |
| splits = get_image_metadata_from_path(path) | |
| coords = splits[1:9] | |
| coords = [float(c) for c in coords] | |
| lat1, lon1, lat2, lon2, lat3, lon3, lat4, lon4 = coords | |
| return lat1, lon1, lat2, lon2, lat3, lon3, lat4, lon4 | |