[GRASS-user] problems importing vector and raster data via python script

Sonja Jankowfsky sonja.jankowfsky at cemagref.fr
Wed Jan 27 11:00:00 EST 2010


I'm running a python script under windows/eclipse, where I try to import 
a shape and a raster file with v.in.ogr and r.in.gdal.


grass.run_command("r.in.gdal",'-o', 
input='E:\pythoninput\mnyzeron5m.asc', output='dem5m', '-o')

grass.run_command("v.in.ogr", '-o', 
dsn='E:\pythoninput\Mercier_ditch.shp', output='ditch2', '-o')


The problem is that I can't use the '-o' flag to override the projection 
check. If I put the '-o' at the end, I get the following error message:


 grass.run_command("r.in.gdal", input='E:\pythoninput\mnyzeron5m.asc', 
output='dem5m', '-o')
SyntaxError: non-keyword arg after keyword arg


If I put the '-o' before the input it is ignored, and I get the error 
that the projection does not match the current location.


 grass.run_command("r.in.gdal", '-o', 
input='E:\pythoninput\mnyzeron5m.asc', output='dem5m')


ERREUR :Projection of dataset does not appear to match current location.


        Location PROJ_INFO is:
        name: Lambert Conformal Conic
        proj: lcc
        ellps: clark80IGN
        lat_1: 46.8
        lat_0: 46.8
        lon_0: 0
        k_0: 0.99987742
        x_0: 600000
        y_0: 2200000
        towgs84: -168,-60,320,0,0,0,0
        pm: paris
        no_defs: defined

        Import dataset PROJ_INFO is:
        cellhd.proj = 0 (unreferenced/unknown)

        You can use the -o flag to r.in.gdal to override this check and use
        the location definition for the dataset.
        Consider generating a new location from the input dataset using the
        'location' parameter.


Does anybody know how I can actually override the projection check?

Sonja



More information about the grass-user mailing list