[gdal-dev] Re: prj to proj.4

Hermann Peifer peifer at gmx.eu
Thu Mar 26 11:35:42 EDT 2009


Brent Wood wrote:
> Hermann,
>
> This might work for you, although far from elegant :-)
>
> If you generate a GMT file (using ogr2ogr) of each of the shapefiles, & just grep out the relevant lines from each file (@Jp is the proj.4 text, @Jw is the WKT version), it should give you both the WKT & proj.4 versions of the projection, (or just grep "@Jp" for the proj one); eg, ...
>   

This is actually what I am doing already as a workaround (I mentioned 
this in my first mail). I just do it inside a small bash/AWK script, 
which says somewhere in the middle:

 if ( /^# @Jp/ )
       proj = substr($0, 6)


Just to finish the story with the Rob's Python script:
With the helpful hints from the list I got around the initial problems, 
which mainly originate from the fact that I am not root on the target 
system. I was able to import osr, but then libgdal.so.1 was claimed to 
be missing (it is there, in $HOME/lib, but this is probably not where it 
is expected to be). Then there was the need for changing the PYTHONPATH, 
which I can do for myself, but not for the account under which the 
script is expected to run later...

To make a long story short: I will have to convince the system admin to 
provide a more sustainable fix of these issues and until I have his 
willingness to do so, I will simply continue with my tmp.gmt workaround.

Thanks for the support. It will just take some time before I can benefit 
from it.

Hermann




More information about the gdal-dev mailing list