AnsweredAssumed Answered

Change spatial reference of JSON input coords

Question asked by jamesfreddyc on Jan 6, 2016
Latest reply on Jan 6, 2016 by jamesfreddyc

I'm trying to figure out how to project individual polygon features that I'm constructing from a JSON input that gets parsed from coordinates.  The input looks like this:


feature_info = """[{"rings":[[[-9050993.00, 3222038.00],[-9049770.00, 3220509.00],[-9047629.00, 3213783.00],[-9054356.00, 3215923.00],[-9050993.00, 3222038.00]]]}]"""


I do not have problems creating the polygon, however I need to project the feature (see the inSr and outSr variables for their WKID's).  Again, no problems with the projection to that desired system!  But the units are in US Foot and I need it to be in Meters.


Apparently, this property is read only and does not change it:


inSr = arcpy.SpatialReference(3857)
outSr = arcpy.SpatialReference(26758)
outSr.linearUnitName = 'Meter' #this does nothing


Then I see that some have successfully just altered the desired output SpatialReference by manipulating the string value of the projection like this, but again, it still doesn't change the unit to meters for me.  Maybe you can spot the issue?


outSr.loadFromString(re.sub('PARAMETER\[\'Unit\', Foot_US]', 'PARAMETER\[\'Unit\', Meter]', outSr.exportToString())) 
print arcpy.SpatialReference.exportToString(outSr)