Procedure to create spatial indexes for shapefiles on DOS shell

I often need to create indexes for shapefiles. The shapefiles are on remote disc and are on many gerarchical folders
So I use this simply but surely useful procedure to create the indexes using a dos shell.

Suppose the path to the root filder of shapefile is:


you must run this simply script from a shell dos.

for /R F:\folder1\folder2 %f IN (*.shp) do ogrinfo.exe -sql "CREATE SPATIAL INDEX ON %~nf" "%f"

The script start from F:\folder1\folder2 and recurse on all the folders creating the spatial index for every shapefile found.

Happy indexing.

Andrea Peri.

Last modified 10 years ago Last modified on Mar 15, 2012, 2:56:38 AM
Note: See TracWiki for help on using the wiki.