I got Sentinel-1 data in the .SAFE format that I need to export to the BEAM-DIMAP format. I used SNAP to do so.
However, I think I’m losing metadata during the process. Although running gdalinfo on the GeoTiff files in the .SAFE product shows the Coordinate Reference System, it is not the case when I run it on the .img files within the .data directory of the BEAM DIMAP format.

How can I retrieve this metadata?

(I know that there is a Coordinate_Reference_System tag in the .dim file but it does not seem complete.)



instead of running gdalinfo you could use the gpt to directly access the S1 GRD product with all its metadata based on the manifest.safe file:

gpt Write -Ssource='C:\path\to\manifest.safe' -Pfile='C:\path\to\output.dim'

I just tested it and it wrote a dim file of Amplitudes, no geocoding, of course:

Thanks for your answer, gpt Write actually does the conversion but the output is the same as when using the export feature in SNAP.
This might be a dump question but I need to extract the Coordinate System in the WKT format, something like that:

GEOGCS[“WGS 84”,DATUM[“WGS_1984”,SPHEROID[“WGS 84”,6378137,298.257223563,AUTHORITY[“EPSG”,“7030”]],AUTHORITY[“EPSG”,“6326”]],PRIMEM[“Greenwich”,0,AUTHORITY[“EPSG”,“8901”]],UNIT[“degree”,0.01745329251994328,AUTHORITY[“EPSG”,“9122”]],AUTHORITY[“EPSG”,“4326”]]

and all I can find is the Coordinate_Reference_System tag in the dim file:

                        <ELLIPSOID_MAJ_AXIS unit="M">6378137.0</ELLIPSOID_MAJ_AXIS>
                        <ELLIPSOID_MIN_AXIS unit="M">6356752.3</ELLIPSOID_MIN_AXIS>

and I can’t see how to do that as I don’t find any information about prime meridium or units in the XML.

I don’t quite get what you are trying to achieve by that. Maybe you can shortly describe your aim so we can better understand and suggest how to help you with it.

I need to use datacube and prior to data ingestion I need to write a preparation script which generates a metadata file, the doc is available here. In this file there should be among other things the CRS. A script is provided as an example in the datacube but it tries to get the CRS from somewhere where there’s nothing so I get an error. The script assumes that the data is in the BEAM-DIMAP format which is why I’d like to perform the conversion.

I know I could write a script from scratch that uses the SAFE format but it seems easier to fix the error in the provided script.

Hope I’ve been clear enough, if I haven’t please let me know.

Thank you that looks interesting.
Sorry for asking but I thought that maybe there was an easier way to achieve things. But in your case I think you’ll have to go the hard way :smirk:

You can get the WKT in SNAP Desktop. Select the product and the from the menu Analysis / Geo-Coding.
You can get it via the API too. For this you would need to write a piece of code in Java or Python.
But it is not possible to get it via gpt.

Thank you for your answer. I managed indeed to do that in SNAP Desktop. Could you please give me a hint of how to do it in Java? I’ve never used the API.