Install GDAL and its dependencies as a release version using triplet. This will install to %VCPKG_ROOT%\installed\<triplet>
vcpkg install --triplet=x64-windows-release gdal[tools,webp,zstd,sqlite3,postgresql,openjpeg,png,geos,libspatialite,curl]
trial
to adopt
Pyogrio is fast because it uses pre-compiled bindings for GDAL/OGR to read and write the data records in bulk. This approach avoids multiple steps of converting to and from Python data types within Python, so performance becomes primarily limited by the underlying I/O speed of data source drivers in GDAL/OGR. We have seen >5-10x speedups reading files and >5-20x speedups writing files compared to using row-per-row approaches (e.g. Fiona).
If you are working with python module that depends on a custom sqlite3.dll, IPython on startup will load sqlite3.dll from the installation's vendored DLLs. This can cause a conflict resulting in a failed DLL load since the module that needs the custom sqlite3.dll cannot override the currently loaded DLL (DLL HELL). | |
WORKAROUND: copy the custom sqlite3.dll to the installation location |
#!/usr/bin/env python | |
# This tool has been copied from https://github.com/vinayak-mehta/pdftopng/blob/main/scripts/wheel_repair.py | |
# and extended to supported hierarchical folder architecture with mulitple .pyd | |
# to update, and to move all the DLL in a common folder *package*.lib installed | |
# jointly with the package itself, similarly to auditwheel on Linux platform. | |
#(see also https://discuss.python.org/t/delocate-auditwheel-but-for-windows/2589/9). | |
# Additionally adapted from https://github.com/Wandercraft/jiminy/blob/648c0ec918ca2c2f734a32bada1dbfaf6226de48/build_tools/wheel_repair.py | |
# added sorting of pyd and dll files such that repaired dlls pointing to their own |
>>> import os | |
>>> os.add_dll_directory('C:\path\to\dll\dir') | |
>>> import rasterio |
""" | |
RPC_DEM_SRS only used in GDAL >= 3.2.0, otherwise ignored | |
""" | |
import rasterio | |
import rasterio.warp | |
from rasterio import logging | |
logging.basicConfig(filename='rasterio.log', level=logging.DEBUG) |
rem https://github.com/OSGeo/PROJ/blob/475e7fd9f11af184e7e1e1618b3e1bb110a79714/src/networkfilemanager.cpp#L1613 | |
set PROJ_UNSAFE_SSL=YES | |
projsync --list-files |
from osgeo import gdal, osr | |
driver = gdal.GetDriverByName("GTiff") | |
src = driver.Create('/vsimem/test.tif', 32, 32, 1) | |
srs = osr.SpatialReference() | |
srs.ImportFromEPSG(4326) | |
src.SetGCPs((gdal.GCP(0, 0, 0, 0, 0),), srs) | |
dst = gdal.Translate('/vsimem/test.vrt', src) | |
print(dst.GetMetadata('xml:vrt')) |
from osgeo import gdal | |
import joblib | |
from itertools import cycle, product, chain | |
from more_itertools import ichunked | |
import time | |
import os | |
SRC = 'RS2_OK76385_PK678064_DK606753_F2N_20080419_142127_HH_HV_SLC/RS2_OK76385_PK678064_DK606753_F2N_20080419_142127_HH_HV_SLC' | |
def block_windows(src, xsize, ysize): |
from itertools import product, chain | |
def block_windows(src, xsize, ysize): | |
height, width = src.shape | |
nrows, rmod = divmod(height, ysize) | |
ncols, cmod = divmod(width, xsize) | |
offsets = product(range(0, width, xsize), range(0, height, ysize)) | |
sizes = product(chain([xsize]*ncols, [cmod]), chain([ysize]*nrows, [rmod])) | |
for (xoff, yoff), (xsize, ysize) in zip(offsets, sizes): | |
yield xoff, yoff, xsize, ysize |