Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@valgur
valgur / gdal_warp.py
Last active April 11, 2022 09:36
gdalwarp with GCPs via GDAL Python bindings
from pathlib import Path
from osgeo import gdal, osr
# Adapted from https://svn.osgeo.org/gdal/trunk/autotest/alg/warp.py
def warp_with_gcps(input_path, output_path, gcps, gcp_epsg=3301, output_epsg=3301):
# Open the source dataset and add GCPs to it
src_ds = gdal.OpenShared(str(input_path), gdal.GA_ReadOnly)
gcp_srs = osr.SpatialReference()
gcp_srs.ImportFromEPSG(gcp_epsg)
gcp_crs_wkt = gcp_srs.ExportToWkt()
@valgur
valgur / get_exif_gps_info.py
Last active June 3, 2019 00:44 — forked from erans/get_lat_lon_exif_pil.py
Get GPS coordinates, direction, speed and timestamp from EXIF using PIL
import datetime as dt
from collections import OrderedDict
from glob import glob
from sys import argv
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):