Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a script that goes through all the rasters in a particular folder and then reprojects it to another coordinate system, using arcpy.

My problem is that i keep on getting the following ERROR 000365: Invalid geographic transformation.

My code fails on this line

        arcpy.ProjectRaster_management(raster, in_memoryLayer, "British National Grid.prj","#", "#", transformation,"#", "#")

I have set the transformation to the following

transformation = "OSGB_1936_To_WGS_1984_7"

and have also tried

transformation = "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]]", "NEAREST", "0.516860387597052", "OSGB_1936_To_WGS_1984_7", "", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433],METADATA['World',-180.0,-90.0,180.0,90.0,0.0,0.0174532925199433,0.0,1262]]"

I got the above from exporting a model from modelbuilder.

but i still get the error.

EDIT: Here is the code for the ProjectRaster tool that is exported from ModelBuilder

arcpy.ProjectRaster_management(inputRaster, convertedRaster, "PROJCS['British_National_Grid',GEOGCS['GCS_OSGB_1936',DATUM['D_OSGB_1936',SPHEROID['Airy_1830',6377563.396,299.3249646]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',400000.0],PARAMETER['False_Northing',-100000.0],PARAMETER['Central_Meridian',-2.0],PARAMETER['Scale_Factor',0.9996012717],PARAMETER['Latitude_Of_Origin',49.0],UNIT['Meter',1.0]]", "NEAREST", "0.521227542928997", "OSGB_1936_To_WGS_1984_7", "", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433],METADATA['World',-180.0,-90.0,180.0,90.0,0.0,0.0174532925199433,0.0,1262]]")

The above does not work when running from python, but the model itself does.

Any advice on where I'm going wrong?

Thanks

share|improve this question
1  
Have you tried running it without using in_memory inputs and outputs? I know the regular project tool cannot use in_memory datasets for inputs and outputs. –  dmahr Mar 6 '13 at 18:33
    
Try using the full path of the projection, e.g. "c:/ArcGIS/projections and coordinates or whatever/British National Grid.prj" –  Jason Mar 6 '13 at 21:42
    
@dmahr, tried that, made no difference –  Halil Siddique Mar 7 '13 at 12:58
    
@Jason, tried that aswell, no difference, I can get it to work when I use modelbuilder but once exported it, i get the error. –  Halil Siddique Mar 7 '13 at 12:59
    
Do you have the NTv2 grid installed? If not you need to download it (below) and put it in ArcGIS install, pedata/ntv2/uk: ordnancesurvey.co.uk/oswebsite/support/os-net/… –  mkennedy Mar 7 '13 at 16:18
show 1 more comment

1 Answer

Halil, check your transformation, OSGB_1936_To_WGS_1984_7, against the list of valid transformations: C:\ArcGIS\Desktop10.0\Documentation\geographic_transformations.pdf.

It is not listed in version of the document I have; only the following transformations for OSGB are valid:

enter image description here

share|improve this answer
    
Isn't there a spatial reference class method at 10.1 that lets you feed in 2 layers and it will return a list of the acceptable transformations between the 2? I'm not on 10.1 and I cannot find it in the docs right now. –  Chad Cooper Mar 7 '13 at 15:10
1  
This is an old list. The document was updated at 10.1. –  mkennedy Mar 7 '13 at 16:23
    
He should still check it, unless you are saying that you already have and it exists in the 10.1 document. –  Jason Mar 7 '13 at 18:22
    
@Jason, its in the 10.1 document. I think I might just stick with creating a model that iterates through my files as we know it works. –  Halil Siddique Mar 7 '13 at 21:15
    
Chad, the tool you are looking for is: gis.stackexchange.com/a/49119/10919 AND resources.arcgis.com/en/help/main/10.2/index.html#//… –  Tom Dec 16 '13 at 23:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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