Select to view content in your preferred language

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

2032
7
Jump to solution
03-18-2016 09:06 AM
RitchieEyster
Emerging 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.

0 Kudos
1 Solution

Accepted Solutions
DarrenWiens2
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
DarrenWiens2
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?

RitchieEyster
Emerging 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 .

0 Kudos
DarrenWiens2
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.

RitchieEyster
Emerging Contributor

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

0 Kudos
FrankHanssen
Regular Contributor

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

Frank

0 Kudos
FrankHanssen
Regular Contributor

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

0 Kudos
FrankHanssen
Regular Contributor

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)

0 Kudos