You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say you have an Non-geo image (as COG already) and some external GCP (e.g from a Georeferencing UI), it would be nice to pass those GCPS to rio_tiler.io.Reader directly to allow virtual georeferencing
After couple hours digging, it seems there is no easy solution.
Notes:
WarpedVRT will no work if the dataset do not have internal GCPS
I was hopping we could pass a list of gcps to WarpedVRT but it's not possible (the underneath GDAL function won't get it either)
The only solution I found was to create a VRT
importxml.etree.ElementTreeasETfromrasterio.vrtimport_boundless_vrt_docfromrasterio.warpimportWarpedVRTwithrasterio.open("image.jpeg") asdataset:
# Use rasterio boundless_vrt_doc to create a VRT xml documentvrt_xml=_boundless_vrt_doc(dataset)
# Update the VRT to add the GCPSvrtdataset=ET.fromstring(vrt_xml)
gcp_list=ET.SubElement(vrtdataset, 'GCPList')
gcp_list.attrib['Projection'] =str(gcps_crs)
forgcpinself.gcps:
g=ET.SubElement(gcp_list, 'GCP')
g.attrib["Id"] =gcp.idg.attrib['Pixel'] =str(gcp.col)
g.attrib['Line'] =str(gcp.row)
g.attrib['X'] =str(gcp.x)
g.attrib['Y'] =str(gcp.y)
vrt_xml=ET.tostring(vrtdataset)
# Open the VRT Dataset and pass it to the WarpedVRTwithrasterio.open(vrt_xml.decode()) asdataset:
withWarpedVRT(
dataset,
src_crs=dataset.gcps[1],
src_transform=transform.from_gcps(dataset.gcps[0]),
) asvrt:
...
Notes:
I'm not sure what _boundless_vrt_doc does so we might not to check if there are any specifics
Let's say you have an Non-geo image (as COG already) and some external GCP (e.g from a Georeferencing UI), it would be nice to pass those GCPS to
rio_tiler.io.Reader
directly to allow virtual georeferencingrio-tiler/rio_tiler/io/rasterio.py
Lines 98 to 110 in 93cf68e
The text was updated successfully, but these errors were encountered: