1

Learning my way through the GIS world, i was able to create a nice script to handle some geotiffed nitf files. Could create png, thumbnails and even kmls from these files with GDAL.

Then I have another file type: .cos, and I can get imagery and thumbnails but cannot use gdal2tiles.py to build kmls from these. That gives me an error (which my n00bness to gis stuff means little to me yet):

gdal2tiles.py -g geodetic -k IMAGE_XDetc.cos 
Usage: gdal2tiles.py [options] input_file(s) [output]

gdal2tiles.py: error: There is no georeference - neither affine transformation (worldfile) nor GCPs. You can generate only 'raster' profile tiles.

Either gdal2tiles with parameter -p 'raster' or use another GIS software for georeference e.g. gdal_transform -gcp / -a_ullr / -a_srs

So it looks like there is no georference in the file, is it impossible to create tiles/kml or a shapefile (just a rectangle of where this would be on a globe) from these kinds of files?

I did a gdalnfo on this cos file type and got

python gdalnfo.py IMAGE_XDetc.cos 
Driver: COSAR/COSAR Annotated Binary Matrix (TerraSAR-X)
Files: IMAGE_XDetc.cos
Size is 6048, 5993
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 5993.0)
Upper Right ( 6048.0,    0.0)
Lower Right ( 6048.0, 5993.0)
Center      ( 3024.0, 2996.5)
Band 1 Block=6048x1 Type=CInt16, ColorInterp=Undefined
Traceback (most recent call last):
  File "gdalnfo.py", line 613, in <module>
    sys.exit(main(sys.argv))
  File "gdalnfo.py", line 512, in main
    ( hBand.GetOffset(), hBand.GetScale()))
TypeError: float argument required, not NoneType

I am not sure what I am missing or how to process this file. I know the UpperLeft and LowerLeft are coordinates I could use but as I posted in this help question :

Creating superoverlay from geotiff covered whole globe, shouldn't of?

I need other things besides that LowerLeft corner etc number to properly process this geo file into a kml for google earth or something.

EDIT: Did find a GEOREF.xml file with some pieces of the snippet here:

There are a ton of these entries:

<gridPoint iaz="12" irg="22">
  <t>7.75109087050168455E-01</t>
  <tau>3.13007399728248718E-05</tau>
  <lat>3.13670474258092860E+01</lat>
  <lon>-1.10901922952670986E+02</lon>
  <row>6434</row>
  <col>5160</col>
  <inc>2.69587903322477729E+01</inc>
  <elev>-9.00217208666371427E+00</elev>
  <height>1.17917304198257625E+03</height>
</gridPoint>

There is like 312 or so of those entries above, and before that has a bunch of information on like signalPropegationEffects, rangeDelay, azimuthShift, platformParameterProcessing...which I am guessing this is all very specific data to the sensor that colleceted the information. No idea if or what is needed to generate some nice KML for this to plot onto a virtual earth??b (more gdal commands?) This script I have running is in python and works pretty well... and I can call through os commands from python gdal2tiles. If there is a command line solution, then cool!, if there is one i can programmatically use that might be better.

2
  • The error is telling you that it doesn't have any information about where on the earth the raster should be placed (lack of georeference). You have to have some method of telling GDAL where the raster is, how big each pixel is, etc. Are there other files associated with this one that you may be missing? Commented Jun 3, 2016 at 17:11
  • You are right there is a GEOREF.xml in another folder I am not sure if this is it (opening the xml has a lot of geogreek to me). I will edit my response to show some of the items, if it does indeed turn out to be the data, can GDAL handle this and gdal2tiles somehow take this .XML file as an argument?
    – Codejoy
    Commented Jun 3, 2016 at 17:20

1 Answer 1

1

It looks like GDAL currently does not support georeferencing information in that format:

Long Format Name                    Code    Creation    Georeferencing  Maximum file size   Compiled by default
...
TerraSAR-X Complex SAR Data Product COSAR   No          No              --                  Yes
...

The documentation on that format is pretty scarce and it sounds like it's still under development.

You may be able to convert it to a format that you can georeference, like TIF, but you would still have to manually specify that georeference info, presumably from the xml file you found.

1
  • good find on the documentation there. DIdn't see it. Though you gave me another idea there was another folder with some tif files but I doubt as you said they have georference info. Maybe I can use another tool to get this cos data into a more usable format. First time GDAL hasn't done something for me hmmm.
    – Codejoy
    Commented Jun 3, 2016 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.