Skip to content

Data with No Projection

Trent Hare edited this page Mar 29, 2023 · 11 revisions

Map projections (PDS4 CART) can consist of a confusing set of parameters, but ultimately these parameters should be machine-translatable. Also, when at all possible, for derived map projected data, it is ideal to use an application that maintains the map projection parameters. However, if a data set was produced outside a package that doesn't maintain a map projection definition, then GDAL can still possibly help. For example, given, say a global map, GDAL can still attempt to create a CART section. This really only works for simple projections (e.g., in degrees, or rectangular in shape).

So given a global map of Pheobe in degrees, to test a PDS4 label try this:

gdal_translate -of PDS4 -a_srs "+proj=longlat +R=106500 +no_defs" -a_ullr -180 90 180 -90 -co VAR_TARGET="Moon" -co UNIT="Albedo" pheobe_albedo_g.fits pheobe_albedo_g_cart.xml

-of = output format
-a_srs = input projection, here just lat/lon in degrees using a PROJ string to define that +R=radius in meters (+a +b for ellipse).
-a_ullr bounds upper left lon/lat, lower right lon/lat
-co VAR_TARGET (optional, but showing how input GDAL templates can have variables). 
    Note here the very simple default (build-in) PDS4 template will be used (data/pds4_template.xml).
-co UNIT="Albedo" (optional, sets the UNIT in the array class for the DNs).
input.whatever.format
output.xml

-here the output pixels will be stored in a raw output.img file. You can also specify -co IMAGE_FORMAT=GEOTIFF for a "raw" GeoTIFF

more: https://gdal.org/drivers/raster/pds4.html