Lat/long to Pixel transformation

Hi @daveluo_gfdrr, Hi @emily, Hi all,

I am wondering how to transform the lat/long coordinates of a specific building polygon into pixel coordinates relative to the top left corner of a tiled window.

Ali

1 Like

Hi,

This gets into how affine transformation matrices are used to convert between points in a Coordinate Reference System to a display of pixels and vice versa. Here’s some background reading that should help:

https://rasterio.readthedocs.io/en/latest/quickstart.html#dataset-georeferencing
https://shapely.readthedocs.io/en/latest/manual.html#affine-transformations

I’ve also updated the STAC data intro tutorial with a bonus section demo’ing how this works with the example chip: https://nbviewer.jupyter.org/gist/daveluo/57ada6ba61ff7c947aad8d6aaeeeb9e4#Bonus-material-on-saving-chipped-images-and-labels-as-geotiffs

2 Likes

Thank you @daveluo_gfdrr.

Nice article :+1:

2 Likes