AnsweredAssumed Answered

Trouble editing centralMeridian of spatial reference

Question asked by clm42 on Feb 15, 2013
Latest reply on Oct 26, 2015 by Dan_Patterson
I was trying to make a nice gif for Valentines day to put on our website of the earth rotating in the Werner projection. I made a map with the Bonne projection and changed the central parallel in ArcMap to 89.9 (wont take 90 for some reason) which gives a Stabius-Werner projection in essence. I wrote up a quick bit of code to kick out a png for each meridian between 0 and 359. I was going to merge them into an animated graphic but I cant seem to get the spatialReference object to update. Its moot since Valentines day was yesterday but Im mad at it now and want to make this work.

Making the change by hand in ArcMap data frame options works but is slow; making the change in IDLE or the python window does nothing.:
>>> import arcpy
>>> MXD = arcpy.mapping.MapDocument(r'C:\GIS Projects\FY13\County\Valentines\valentines_werner.mxd')
>>> DF = arcpy.mapping.ListDataFrames(MXD)[0]
>>> DF.spatialReference.centralMeridian
0.0
>>> DF.spatialReference.centralMeridian = 180.0
>>> DF.spatialReference.centralMeridian
0.0
>>> 


My script does nothing either. I left in commented out ways I tried to feed the number in that also didnt work.:
import arcpy

MXD = arcpy.mapping.MapDocument(r'C:\GIS Projects\FY13\County\Valentines\valentines_werner.mxd')
DF = arcpy.mapping.ListDataFrames(MXD)[0]
 
for CM in range(0,360):
    SR.centralMeridian = CM
    DF.spatialReference = SR
    #DF.spatialReference.centralMeridian = CM
    #DF.spatialReference.loadFromString(u"PROJCS['Sphere_Bonne',GEOGCS['GCS_Sphere',DATUM['D_Sphere',SPHEROID['Sphere',6371000.0,0.0]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Bonne'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',%d.0],PARAMETER['Standard_Parallel_1',89.9],UNIT['Meter',1.0]];-13065200 -16679400 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision"%CM)
    arcpy.mapping.ExportToPNG(MXD,
                              r'C:\GIS Projects\FY13\County\Valentines\%02d.png'%CM,
                              DF,
                              df_export_width = 3000,
                              df_export_height = 3000,
                              resolution=300)

Outcomes