Hermann, Actually you don't even need to have root priviledge to use the GDAL bindings. Go to swig/python and do "make install". This will generate the shared libraries and at the end it will error out because it can't install them in /usr/local/lib/python2.5/site-packages (or something similar)
Then you need to hand copy into the directory where you put your python script the following files/directories : swig/python/ogr.py swig/python/osr.py swig/python/gdal.py swig/python/gdalconst.py swig/python/gdalnumeric.py swig/python/build/lib.linux-i686-2.5/osgeo/_gdal.so swig/python/build/lib.linux-i686-2.5/osgeo/_gdalconst.so swig/python/build/lib.linux-i686-2.5/osgeo/_osr.so swig/python/build/lib.linux-i686-2.5/osgeo/_ogr.so swig/python/build/lib.linux-i686-2.5/osgeo/_gdal_array.so swig/python/osgeo (directory) (If you're running on Windows, this should be similar. Replace the .so by the .dll) Best regards, Even Le Wednesday 25 March 2009 18:31:07 Hermann Peifer, vous avez écrit : > Howard Butler wrote: > > Looking at the .prj file and searching http://spatialreference.org might > > also be productive. > > > > Another option is to upload it to spatialreference.org, and you can then > > get it in a number of formats. This approach isn't recommended for a > > lot of SRS's, but for a quick one-off sort of thing, it's pretty handy. > > > > Howard > > Thanks for the hint, but I have 1000's of shapefiles which have all > kinds of SRS's. So spatialreference.org doesn't seem to be the best > option in my case. Rob's python script below actually looks like what I > was looking for. Python is available on my system. I am however not root > there. I still have to convince the system admin to install the gdal > site-package, so that I can: import osr > > Hermann > > > On Mar 25, 2009, at 5:49 AM, Robert Coup wrote: > >> Hi Hermann, > >> > >> On Wed, Mar 25, 2009 at 9:06 PM, Hermann Peifer <[email protected]> wrote: > >> > >> I am looking for a convenient way to convert the SRS parameters from a > >> random shapefile.prj into proj.4 format. A command line interface > >> would be most helpful for a non-programmer, like me. > >> > >> > >> If you have python on your system (likely), then you can create a > >> python script (eg. prj2proj.py) with the following code in it, then > >> run "python prj2proj.py my.prj" and it'll print the proj4 equivalent > >> of the my.prj file. > >> > >> HTH, > >> > >> Rob :) > >> > >> > >> #!/usr/bin/env python > >> > >> import osr > >> import sys > >> > >> def main(prj_file): > >> prj_text = open(prj_file, 'r').read() > >> srs = osr.SpatialReference() > >> if srs.ImportFromWkt(prj_text): > >> raise ValueError("Error importing PRJ information from: %s" % > >> prj_file) > >> print srs.ExportToProj4() > >> > >> if __name__=="__main__": > >> main(*sys.argv[1]) > >> > >> _______________________________________________ > >> gdal-dev mailing list > >> [email protected] > >> http://lists.osgeo.org/mailman/listinfo/gdal-dev > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
