How can i get the (x, y) pixel position from the geographical coordinates in a Sentinel-1 Synthetic Aperture Radar (SAR) satellite image?
I can access a downloaded image info sg as
from snappy import ProductIO
path='path_name'
product = ProductIO.readProduct(path)
sg = product.getSceneGeoCoding()
But how can I get (x, y) pixel position for a desired latitude and longitude using ESA's snap engine within Python?
Using the custom function below, we can easily convert any (latitude, longitude) to it' s (x, y) position in image, provided that latitude and longitude is within the limits of our product.
UPD: Updated function below should work with more snap versions
E.g. for the given product bellow (as we can see in scihub it's a product in southern Greece), we can get (x, y) position in image of Athens coordinates (latitude=37.9838, longitude=23.7275) as
productname : S1A_IW_GRDH_1SDV_20170821T162310_20170821T162335_018024_01E414_C88B