I want to create my own projected coordinate system based on one of geographical coordinate systems and set custom values to properties as longitude
, scaleFactor
etc.
I found SpatialReference class.
But can't understand how set geographical coordinate system that will be base for my coordinate system - GCS
property is read only, and no methods for set its value.
And also, when I calls create
method, result is RuntimeError: ERROR 999999: Error executing function
.
Article has example with only reading existing property, but hasn't examples with creating CS.
What am I doing wrong, and where can I find examples for CS creating?
My code:
new_sr = arcpy.SpatialReference()
new_sr.linearUnitName = u'meters'
new_sr.longitude = 30
new_sr.longitudeOf1st = 10
new_sr.longitudeOf2nd = 50
new_sr.longitudeOfOrigin = 30
new_sr.projectionCode = 100500
new_sr.projectionName = u'my_projection'
new_sr.scaleFactor = 2
new_sr.standardParallel1 = 50
new_sr.standardParallel2 = 60
new_sr.create() # RuntimeError: ERROR 999999: Error executing function
May be I must set some other properties, or vice versa remove unnessecary?
arcpy.SpatialReference
can't change values for some reason (this magic is described in article), not only because of wrong parameters count or values – General Failure Nov 7 '15 at 5:20