Re Project

11-22-2013 11:59 PM
New Contributor

It will be a great help if anyone can suggest me a process or automation/tool to re project a raster in jpeg format by taking the projection values and coordinate system from a preexisting raster which exist in .img format. The reason of asking the needful is as both the images are of the same area but are opening at different location. The .img format is having the correct parameters.

0 Kudos
2 Replies
Occasional Contributor III
You can use Model Builder or Python script. Loading the control point of .img might work.
0 Kudos
Occasional Contributor III
I am not sure what exactly you are trying to do, because if the image image is correctly projected you should not need to do a translate. Are you trying to georeference the image? Anyway I will provide same quick snippets of accomplishing both (via python)

1) Getting spatial reference
raster = arcpy.Raster(rasterPath)
sourceSR = raster.spatialReference    # reading spatial reference from Raster

sourceSR = arcpy.SpatialReference(srCode)  # if you know the code

2) Getting source points
_minX = raster.extent.XMin
_minY = raster.extent.YMin
_maxX = raster.extent.XMax
_maxY= raster.extent.YMax

3) Creating control points (you can create source and target accordingly)
source_control_points = "'" + str(_minX) + " " + str(_maxY) + "';'" + str(_maxX) + " " + str(_maxY) + "';'" + str(_maxX)  + " " + str(_minY) + "';'" + str(_minX) + " " + str(_minY) + "'"
4) Georeferencing
arcpy.Warp_management(img_path, source_control_points, target_control_points, out_raster, "POLYORDER1","NEAREST")

I hope this helps !!!
0 Kudos