In QGIS/GRASS, is it possible to list the projection details of all the shp,tab,dxf files in a folder ? We are having 100 - 150 files in too many folders. We would like to create a table of Proj details of all the files in those folders. Any idea ?
1 Answer
GDAL ogrinfo is able to report the projection information of shapefiles.
You can use it recursively in batch mode in OSGeo4w or Linux/Mac Terminal. The command line for recursion is dependent on the operating system.
For Windows, try:
for /R .\ %%N IN (*.shp) DO ogrinfo -al -so %%N >>outogr.txt
or using gdalsrsinfo on the .prj file:
for /R .\ %%N IN (*.shp) DO (echo %%N >>outprj.txt & gdalsrsinfo %%~nN.prj >>outprj.txt)
-
Thanks for the answer. But, i am very much new to python/command line/etc... So i dont know how to proceed. I've installed FWTools (even from QGIS we can access this, rite ?) & figured out ogrinfo -so (Summary only) will do the job for me (think so). But don't know how to set the path for a particluar folder and export the result a csv or table.. Could you shed light on how i have to proceed ? Will be immensely helpful.– joseph_kMay 15, 2014 at 4:23
-
ogrinfo -al -so Folder_Path is listing all the details of the shapefiles in a particular folder. More or less, this is wat i am looking for. Only few things.. 1) Won't it read the tab or dxf files in those folders ? 2) How to export this summary into a csv file or txt or table ? 3) is it possbile to use this as a python script in QGIS ?– joseph_kMay 15, 2014 at 4:35
-
Command line is different from python console. You have not told me which operating system you are using. This is essential for the command line recursion syntax.– AndreJMay 15, 2014 at 5:10
-
We are using Windows 7 Professional I am trying with this one For /R "Folder_Path" %f in (*.tab) do ogrinfo -al -so %f >> Projection.txt It reads all the tab file. But, it says "Access is denied"– joseph_kMay 15, 2014 at 5:20
-
Not sure about the .tab, I don't have any. See my extended answer for shapefiles.– AndreJMay 15, 2014 at 5:39