Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How reference many Rasters to other rasters (Warb) #51

Open
agmna opened this issue Aug 1, 2018 · 1 comment
Open

How reference many Rasters to other rasters (Warb) #51

agmna opened this issue Aug 1, 2018 · 1 comment

Comments

@agmna
Copy link

agmna commented Aug 1, 2018

I am try to reference many Rasters to other rasters (Warb) using python code, But I feild, I need help.

import arcpy

i = 0

while i <= 1:

inRasterworkspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI_R'
#inRasterworkspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = inRasterworkspace
inRasters = arcpy.ListRasters()
inRaster = inRasters[i]

SoTop=arcpy.GetRasterProperties_management(inRaster , "TOP")
SoLeft=arcpy.GetRasterProperties_management(inRaster , "LEFT")
SoRight=arcpy.GetRasterProperties_management(inRaster , "RIGHT")
SoBottom=arcpy.GetRasterProperties_management(inRaster , "BOTTOM")
Source_pnt = '''+ str(SoLeft) + ' ' + str(SoTop) + '' ;' + str(SoRight) + ' ' + str(SoTop) + '' ;' + str(SoLeft) + ' ' + str(SoBottom)+'''

========================

taRasterworkspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI2018'
#taRasterworkspace = arcpy.GetParameterAsText(1)
arcpy.env.workspace = taRasterworkspace
taRasters = arcpy.ListRasters('*', 'jpg')
taRaster = taRasters[i]

TaTop=arcpy.GetRasterProperties_management(taRaster , "TOP")
TaLeft=arcpy.GetRasterProperties_management(taRaster , "LEFT")
TaRight=arcpy.GetRasterProperties_management(taRaster , "RIGHT")
TaBottom=arcpy.GetRasterProperties_management(taRaster , "BOTTOM")
Target_pnt = '''+ str(TaLeft) + ' ' + str(TaTop) + '' ;' + str(TaRight) + ' ' + str(TaTop) + '' ;' + str(TaLeft) + ' ' + str(TaBottom)+'''

========================

arcpy.env.workspace = r'C:\Users\AgmnDesk\Desktop\GooleImage\GI2018'
arcpy.env.overwriteOutput = True
arcpy.Warp_management(str(taRaster), Source_pnt, Target_pnt, str(taRaster[:-4])+'tif', "POLYORDER2", "BILINEAR")

========================

i = i + 1

@jdrisdelle
Copy link
Contributor

Hi @agmna . This repro is specifically used for the python rastrer fucntion API. General arcpy python questions are typically posted on geonet . We can still take a look at it but we may want to move the conversation there so that others can find it for future reference. Where in this code i the problem occurring? Are you getting an error when you run this script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants