Projecting multiple images from one coordinate system to another,

1948
11
Jump to solution
09-26-2013 10:42 AM
Highlighted
by Anonymous User
Not applicable
Original User: Jamal432@gmail.com

Projecting multiple images from one coordinate system to another,

I wanted to project multiple Jpeg images form Israel to Palestine coordinate system using the batch of the ???project raster??? tool but couldn???t figure out how the input raster are populated automatically in the ???output raster dataset???

[ATTACH=CONFIG]27794[/ATTACH], [ATTACH=CONFIG]27795[/ATTACH]

Is there a way to populate the images automatically in the ???output raster dataset????


Thank you

Best

Jamal
0 Kudos
1 Solution

Accepted Solutions
Highlighted
by Anonymous User
Not applicable
Original User: JSkinn3

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.

View solution in original post

0 Kudos
11 Replies
Highlighted
by Anonymous User
Not applicable
Original User: JSkinn3

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.

View solution in original post

0 Kudos
Highlighted
Honored Contributor
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.


Many thanks Jake for the help,

Sorry but I couldn�??t know how to integrate the code you have provided with the �??project raster�?� tool. Could you please elaborate a bit more.

[ATTACH=CONFIG]27804[/ATTACH]

By the way, I like the behavior of the �??raster to other format�?� tool where the output is populated automatically in the specified folder. Why the design of the �??project raster�?� is not developed to be the same as �??raster to other format�?�?

[ATTACH=CONFIG]27805[/ATTACH]


Best

Jamal
0 Kudos
Highlighted
by Anonymous User
Not applicable
Original User: JSkinn3

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'.
0 Kudos
Highlighted
Honored Contributor
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'.



Thank you Jake very much for the prompt help. It works fantastically.

While the code you have already sent is great in its current form, I still couldn�??t figure out why the behavior of the �??project raster�?� can�??t be developed to be the same as �??raster to other format�?� such that multiple projected raster can be populated automatically in the specified folder.

[ATTACH=CONFIG]27818[/ATTACH]

Meanwhile, how the coded you have already sent can be further developed to allow the user to specify the input and output of raster (on the hard drive)?
Is it also possible to be developed in form of script tool?

[ATTACH=CONFIG]27819[/ATTACH]
0 Kudos
Highlighted
by Anonymous User
Not applicable
Original User: prabinrokaya@gmail.com

Can anyone tell me how can I project thousands of bil images into WGS_1984_UTM_Zone_37N?
0 Kudos
Highlighted
MVP Frequent Contributor
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
0 Kudos
Highlighted
by Anonymous User
Not applicable
Original User: prabinrokaya@gmail.com

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 Rokaya
MSC, 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
0 Kudos
Highlighted
MVP Frequent Contributor
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
0 Kudos
Highlighted
by Anonymous User
Not applicable
Original User: Jamal432@gmail.com

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 Rokaya
MSC, UNESCO-IHE Institute for Water Education


Hi Neil,

I�??m not sure if this code can be developed in form of geoprocessing tool. This would be much more easier for the end users. This command is a need for everybody

Also, I would like to point out that the code originally provided by Jake includes all parameters required for the projection.


Best

Jamal
0 Kudos