How to create pivot point from fields in a feature class to rotate a raster?

1333
7
Jump to solution
03-18-2016 09:06 AM
Highlighted
New Contributor


I have a feature class that contains all attributes of a given raster dataset.  I need to rotate the raster dataset about the center of the raster.  I have the center x and y values and need to create the pivot point from these values.

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
MVP Honored Contributor

I assume you've found the Rotate tool and want to use the optional pivot point parameter. Doesn't it work to type in the xy values you want to use?

edit: I'm not sure what this means: "I have a feature class that contains all attributes of a given raster dataset." You do have a raster to rotate, correct?

View solution in original post

7 Replies
Highlighted
MVP Honored Contributor

I assume you've found the Rotate tool and want to use the optional pivot point parameter. Doesn't it work to type in the xy values you want to use?

edit: I'm not sure what this means: "I have a feature class that contains all attributes of a given raster dataset." You do have a raster to rotate, correct?

View solution in original post

Highlighted
New Contributor

I have the rotate tool but I am doing this in Modelbuilder. I would like to automatically create the pivot point from the x and y values for each of the 339 rasters that I have .

Reply
0 Kudos
Highlighted
MVP Honored Contributor

Then you'll have to use an iterator, collect the pivot point coordinates in a variable, and pass those using inline variable substitution. But, that's about as much help as I'll be with Modelbuilder.

Highlighted
New Contributor

Thank You Darren. I believe I have it working now.

Reply
0 Kudos
Highlighted
New Contributor III

How did you collect the pivot point coordinates in a variable and define the inline variabel?

Frank

Reply
0 Kudos
Highlighted
New Contributor III

I figured out how to do this. But the output pivot point was not in real coordinates. My input raster is in UTM33 (WGS84).

Reply
0 Kudos
Highlighted
New Contributor III

To get real coordinates for the pivot point use:

def fn(Input):

  import arcpy

  myRaster = arcpy.Raster(Input)

  ext = myRaster.extent

  midx = ext.XMin + ((ext.XMax - ext.XMin) / 2)

  midy = ext.YMin + ((ext.YMax - ext.YMin) / 2)

  return "{0} {1}".format(midx,midy)

Reply
0 Kudos