I have a catalog tree and in every folder I have a number of shapefiles, images and mxd files. The shapefiles are all in Greek Grid projection system (EPSG: 2100).

What I want to do is to batch reproject every shp in every subfolder from EPSG: 2100 to EPSG: 3035 which is the ETRS89 LAEA projection system.

How to this using ogr2ogr or python?

  • 1
    does it have to be python? if not, what OS are you on? – bugmenot123 Sep 17 '15 at 13:07

There are two components to the problem as I read it:

  1. How to project the shapefile into the desired projection
  2. Recurse a directory structure projecting every shapefile you encounter.

In terms of the first - I'm unfamiliar with the those projections but since one is a transverse mercator (spatial reference org) and the other is lamberts equal area and are on different datums you will have to use the correct transformation to preserve the accuracy of your coordinates. When in doubt project the greek grid into UTM first as most national survey offices will have a documented procedure to get their national grid into UTM and it may make it easier to identify the steps involved.

Second recursing a directory structure for this work is fairly straightforward in python. Check the documentation on the builtin os module - particularly you will want os.walk. You can use this to action your projection routine on every shapefile in the entire tree under the folder you use as argument to os.walk. Very powerful and timesaving.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.