Gpt: geographic conversion

Dear all,

I would like to understand how gpt converts latitude/longitude values to x/y points.

Thanks in advance for your collaboration,

Do you mean the row and colum number of a pixel?
What data are you talking about?

Exactly, the x and y number of a pixel used on pin locator and gpt (to do pixel extractions automatically).
SEN3 Olci.

That means you set a pin on a pixel and want to know which position (x/y) in the raster it has?
Or do you want to extract the pixel value at a given lat/lon coordinate for multiple images?

I would like to understand how the system translate my input lat/lon to pixel x/y.

I’m not sure but I think the opposite is the case. Each pixel with x and y can be assigned to a geographic coordinate in latitude and longitude. You can use the tie-point grids in the product to read the corresponding lat and lon value of any pixel.

Thanks for your answer…but the question is: how gpt determine where is exactly degrees coordinates? Using pixel info you can see exactly the center of the pixel but when I asked a pixel towards the edge, which pixel gpt return me? To retrieve this in my code, I used the haversine formala, that return the great-circle distance between two points on a sphere but I would like to understand how gpt determine these values x and y.

Hi Monica,

first, you should use SNAP and not gpt as name for the application. gpt is just one command line tool provided by SNAP.

However, there are different ways from lat/lon coordinates to x/y coordinates.
It depends on which data you are using. Sometimes there is with each pixel x/y a lat/lon coordinate given, sometimes there is only a sparse tie-point grid and in between the tie-points we need to interpolate the lat/lon coordinates. And then are cases were an affine transform is available to compute the lat/lon for a given x/y.

After retrieving the x/y for a given lat/lon, the values at x/y is returned, even if the location is at the edge of the pixel.
We don’t use the great-circle distance between two points here.

Thanks for your answer :wink:
Using the word gpt, I’m referring to gpt with pixex module.
In any case, are you able to give me the method implemented using S3A raster data sets?

you can find the code for the pixel-based approach here:

and the tie-point-based here: