<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Change spatial reference of JSON input coords in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564935#M44207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I can just apply some simple math to arrive at a solution but feel free to shoot it down and suggest a better way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;prjpolygon = polygon.projectAs(outSr)
parea = prjpolygon.getArea()
sqmeters = parea * 0.09290304&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 00:20:59 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2021-12-12T00:20:59Z</dc:date>
    <item>
      <title>Change spatial reference of JSON input coords</title>
      <link>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564934#M44206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&amp;nbsp; The input looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;feature_info = """[{"rings":[[[-9050993.00, 3222038.00],[-9049770.00, 3220509.00],[-9047629.00, 3213783.00],[-9054356.00, 3215923.00],[-9050993.00, 3222038.00]]]}]"""&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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).&amp;nbsp; Again, no problems with the projection to that desired system!&amp;nbsp; But the units are in US Foot and I need it to be in Meters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Apparently, this property is read only and does not change it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-family: Consolas;"&gt;inSr = arcpy.SpatialReference(3857)&lt;/SPAN&gt;
outSr = arcpy.SpatialReference(26758)
outSr.linearUnitName = 'Meter' #this does nothing&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Maybe you can spot the issue?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;outSr.loadFromString(re.sub('PARAMETER\[\'Unit\', Foot_US]', 'PARAMETER\[\'Unit\', Meter]', outSr.exportToString())) 
print arcpy.SpatialReference.exportToString(outSr)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:20:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564934#M44206</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T00:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: Change spatial reference of JSON input coords</title>
      <link>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564935#M44207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think I can just apply some simple math to arrive at a solution but feel free to shoot it down and suggest a better way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;prjpolygon = polygon.projectAs(outSr)
parea = prjpolygon.getArea()
sqmeters = parea * 0.09290304&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:20:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564935#M44207</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T00:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change spatial reference of JSON input coords</title>
      <link>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564936#M44208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Even better solution is to just set proper parameters on the .getArea() method:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;prjpolygon = polygon.projectAs(outSr)
sqmeters = prjpolygon.getArea('PLANAR','Meters')&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:21:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/change-spatial-reference-of-json-input-coords/m-p/564936#M44208</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-12T00:21:02Z</dc:date>
    </item>
  </channel>
</rss>

