5

Unfortunately, GDAL does not support a particular projection I am trying to achieve (the ob_tran rotated pole projection), so I am trying to use PROJ4 to convert a geotiff file to the projection I want.

However, I am not sure what the correct syntax for such an operation is. Using the command:

invproj -m 57.2957795130823 +proj=ob_tran +o_proj=latlon +o_lon_p=20 +o_lat_p=20 +lon_0=180 input.tif

I get only a lot of gibberish in the console, such as:

133d13'9.044"E  62d0'32.793"N  <Item name="missing_value" sample="0">-32767</Item>
133d13'9.044"E  62d0'32.793"N  <Item name="NETCDF_VARNAME" sample="0">Band1</Item>
133d13'9.044"E  62d0'32.793"N</GDALMetadata>
133d13'9.044"E  62d0'32.793"N
133d13'9.044"E  62d0'32.793"N� �D�k�����������k�R�f�����P�w��B�����|�[�=�$

This is not due to the particular projection I am trying to use. Trying a normal Mercator projection with the command:

proj +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +units=m +k=1.0 +nadgrids=@null +no_defs input.tif

I also get a lot of gibberish.

0.00    -0.00�4�L�}�z���`����)�,�$��������
0.00    -0.00��6�������G�R�f�@�
0.00    -0.00
0.00    -0.00�
0.00    -0.00���������3���<�����;
0.00    -0.00�����

What am I doing wrong? From looking at the manual, I thought I need to put the name of the file(s) at the end of the command line, but apparently, that is wrong?

How do I convert a file to another projection with PROJ4?

2 Answers 2

1

The lack of ob_tran in GDAL is a known bug and has a ticket here:

http://trac.osgeo.org/gdal/ticket/4285

You will find a few workarounds in this ticket. Maybe they will help you further.

I assume if there was an easy way to implement it, the developers would have done it already.

The relevant source code of PROJ can be found here:

http://code.google.com/p/route-me/source/browse/trunk/Proj4/PJ_ob_tran.c?r=369

Using a projection on the sphere (instead of an ellipsoid) might simplify your task.

If you want to use proj.exe, try with some ASCII files containing the coordinates.

8
  • As far as I understand, the workarounds recommend using PROJ4. But as I wrote in my question, I can't seem to get PROJ4 to work properly. Maybe I am doing the syntax wrong. Using the command line, what would I have to enter to reproject a file with proj? Mar 9, 2014 at 9:02
  • Proj.exe is only useful to convert files with coordinates in ASCII format. Tif files contain raster information about colour, clima or height, but no coordinates. These are computed from the cell position and the projection information in the tif header. If you have reprojected some points of your file (edges, center etc), you could georeference it. Are your tif files publicly available?
    – AndreJ
    Mar 9, 2014 at 16:08
  • No, the tif files are not publicly available. However, I also have netcdf files of the maps I am trying to reproject, which contain coordinates. But I am not able to reproject them using PROJ4, either. I just get gibberish in the console, and nothing else happens (see my original question for an example). Mar 9, 2014 at 18:04
  • Netcdf is data in binary format. Proj.exe expects ASCII format. That`s why you get unreadable results.
    – AndreJ
    Mar 9, 2014 at 19:49
  • Ah, I see! My mistake. I had assumed that Proj would be able to deal with Netcdf data because the format is so often used for geographic data (or at least the kind of climate data I deal with). So, what exact file format do I have to convert my data to (using GDAL, say) to make it readable by Proj? What endings do these ASCII files have? My apologies, but as you can see, I am relatively new to dealing with these formats. Mar 9, 2014 at 22:01
1

I wasn't able to get PROJ4 to work for me. However, there is an alternative for what I am trying to do: the GMT grdrotater. That should solve my problem. Thank you all for your help!

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.