3

I'm working on an application written with Grass command in python and I have a projection problem. First I create a location with belgian lambert 72 (EPSG:31370) in Grass 7.0.

After importing all the environment variables I run this code:

gscript.run_command("r.in.gdal", input=path+"initialDEM.adf",flags='o', output="DEM")
gscript.run_command("g.region",rats="DEM",res=10)
gscript.run_command("r.out.gdal",input="DEM",type='Byte',output=pathOutput+'finalDEM',overwrite=True,flags='f')

Now I want to import the output raster (finalDEM) in QGIS. And I don't know why the projection change as you can see on the picture. (in red initDEM and in blue finalDEM)

The SCR of the raster finalDEM is USER:100000, *SCR generated .... Do you know why I have this change of projection? Do you know how I can avoid it in my python code?

1 Answer 1

1

Are you sure that the original "initialDEM.adf" is indeed in the EPSG:31370 coordinate system? Instead of importing with the "-o" flag, try to first create a new region that matches the import DEM by running:

r.in.gdal -c input="initialDEM.adf" location="belgium_lambert"

Then rerun r.in.gdal without the "-o" flag.

BTW, what are you trying to do in the above? Changing the region then doing r.out.gdal won't change the output DEM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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