import arcpy from arcpy import env env.workspace = r"D:\Practical1_AddingData\Data" for raster in arcpy.ListRasters("*.jpg"): arcpy.ProjectRaster_management(raster, raster + "_project.jpg", "GEOGCS['GCS_Palestine_1923',DATUM['D_Palestine_1923',SPHEROID['Clarke_1880_Benoit',6378300.789,293.4663155389802]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]","NEAREST","0.0000025","Palestine_1923_To_Israel_1","#","GEOGCS['GCS_Israel',DATUM['D_Israel',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")
Prabin,errr...If the original bil images are not georeferenced then no amount of assigning a coordinate system / projecting and what not is going to help.They are simply not georeferenced. You will have to go through a georeferencing step which involves picking control points from the image and assigning to these points their correct coordinates.But that is rather odd, where did this raster data come from?Neil
Thank you Neil for the assistance. It was really kind of you. But yes, the bil files are not correctly geo-referenced. I also tried to do it via model builder but because file are not properly geo-referenced, it was difficult. Actually I have precipitation images which I want to first geo-referenced (usually I do it via arccatalog, going to spatial reference, edit and selecting GCS WGS 1984) and then through data management tool, project raster, I project them into WGS_1984_UTM_Zone_37N. Then in ArcGIS, I use extract by mask tool to get precipitation map for only my watershed. And calculate value using raster calculator. But the problem I have is, I have thousands of images and I can not do it manually. I wanted to do it via model builder or python and I am looking for assistance as all my attempts to figure it out have failed. It would be really really grateful if you could help me.Thank you for your time and consideration.Prabin RokayaMSC, UNESCO-IHE Institute for Water Education
Are all of your bil files correctly georeferenced and on the WGS84 datum?If so, follow the code template given by Jake above.The WKID for WGS_1984_UTM_Zone_37N is 32637, so, rather than listing the entire text for the projection, I would use the WKID to create a spatial reference object for use in the Project function.Thus : import arcpy from arcpy import env env.workspace = r"Your path to the data here" srOut = arcpy.SpatialReference(32637) for raster in arcpy.ListRasters("*.bil"): arcpy.ProjectRaster_management(raster, raster + "_project.bil", srOut) See the examples here :http://resources.arcgis.com/en/help/main/10.2/#/Project_Raster/00170000007q000000/Cheers and good luck,Neil
import arcpy from arcpy import env env.workspace = r"Your path to the data here" srOut = arcpy.SpatialReference(32637) for raster in arcpy.ListRasters("*.bil"): arcpy.ProjectRaster_management(raster, raster + "_project.bil", srOut)
Open your python window in ArcMap and you can copy/paste the code in there. The code will iterate through your 'D:\Practical1_Adding\Data directory and reproject each JPG. It will write the new projected raster to the same directory with the same name plus "_project" added to it. For example, the image 'yosh_09-06-12_77.jpg' will be reprojected and named 'yosh_09-06-12_77_project.jpg'.
Hi Jamal,I don't believe there is a way to auto populate this parameter. You can easily accomplish this in python, though. Here is an example:import arcpy from arcpy import env env.workspace = r"D:\Practical1_AddingData\Data" for raster in arcpy.ListRasters("*.jpg"): arcpy.ProjectRaster_management(raster, raster + "_project.jpg", "GEOGCS['GCS_Palestine_1923',DATUM['D_Palestine_1923',SPHEROID['Clarke_1880_Benoit',6378300.789,293.4663155389802]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]","NEAREST","0.0000025","Palestine_1923_To_Israel_1","#","GEOGCS['GCS_Israel',DATUM['D_Israel',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")The above code will iterate through the 'D:\Practical1_AddingData\Data' directory and reproject each JPG to a new JPG with the same name, just with "_project" added to it.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.