<?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: convert coordinates on the fly? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322473#M25120</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000038000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SearchCursors will let you set a spatial reference&lt;/A&gt;, you can insert points at a different spatial ref than what the feature class is set to.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if I do this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
c = arcpy.InsertCursor(myFC, differentSpatialRef)
for r in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; x = c.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.X = r[1] # x in old spatRef 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.Y = r[2] # y n old spatRef
&amp;nbsp;&amp;nbsp;&amp;nbsp; x.shape = pnt
&amp;nbsp;&amp;nbsp;&amp;nbsp; c.insertRow(x)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...then the XY's will be in the new SF?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:18:53 GMT</pubDate>
    <dc:creator>KevinBell</dc:creator>
    <dc:date>2021-12-11T15:18:53Z</dc:date>
    <item>
      <title>convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322470#M25117</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a big list of data that includes XY's in one spatial ref, but I'd love to use another spatial ref when I insert into a point object.&amp;nbsp; Other wise I have to insert it into a temp FC, then project it, then delete the temp FC.&amp;nbsp; Is there a more elegant method?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:33:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322470#M25117</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-06-28T17:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322471#M25118</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Check out Corpscon. I've used it in the past and works well to take a text file with coordinate pairs + other attribute info and re-project and write to a new file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.tec.army.mil/corpscon/"&gt;http://www.tec.army.mil/corpscon/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 17:44:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322471#M25118</guid>
      <dc:creator>MichaelMiller2</dc:creator>
      <dc:date>2012-06-28T17:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322472#M25119</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000038000000"&gt;SearchCursors will let you set a spatial reference&lt;/A&gt;&lt;SPAN&gt;, you can insert points at a different spatial ref than what the feature class is set to.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 18:08:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322472#M25119</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-06-28T18:08:07Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322473#M25120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000038000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SearchCursors will let you set a spatial reference&lt;/A&gt;, you can insert points at a different spatial ref than what the feature class is set to.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So if I do this...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
c = arcpy.InsertCursor(myFC, differentSpatialRef)
for r in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; x = c.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.X = r[1] # x in old spatRef 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.Y = r[2] # y n old spatRef
&amp;nbsp;&amp;nbsp;&amp;nbsp; x.shape = pnt
&amp;nbsp;&amp;nbsp;&amp;nbsp; c.insertRow(x)
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...then the XY's will be in the new SF?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:18:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322473#M25120</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2021-12-11T15:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322474#M25121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It will treat the coordinates in your points as being in that spatial reference, and then reproject them to the spatial reference of the feature class when it inserts them.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Jun 2012 19:21:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322474#M25121</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-06-28T19:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322475#M25122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is still producing NAD27 points and I'm trying to get NAD83...&amp;nbsp; What am I missing here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

godataselect = "SELECT gd.primary_key, ........... 'Assault Aggravated')"

rows = dbCursor.execute(godataselect)

incs = r'C:\Program Files (x86)\ArcGIS\Desktop10.0\Coordinate Systems\Projected Coordinate Systems\State Plane\NAD 1927 (US Feet)\NAD 1927 StatePlane Utah Central FIPS 4302.prj'
inSF = arcpy.SpatialReference(incs)

outcs = 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.0\\Coordinate Systems\\Projected Coordinate Systems\\State Plane\\NAD 1983 (US Feet)\\NAD 1983 StatePlane Utah Central FIPS 4302 (US Feet).prj'
outSF = arcpy.SpatialReference(outcs)

arcpy.CreateFeatureclass_management ('default.gdb', 'nad83', 'POINT', 'default.gdb\\template') #NAD83
arcpy.DefineProjection_management ('default.gdb\\nad83', outSF)

c = arcpy.InsertCursor('default.gdb\\nad83', inSF)

for r in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print r
&amp;nbsp;&amp;nbsp;&amp;nbsp; rr = c.newRow()
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; rr.xml_primary_key = r[0].strip()
&amp;nbsp;&amp;nbsp;&amp;nbsp; rr.officer_id = r[1].strip()
&amp;nbsp;&amp;nbsp;&amp;nbsp; rr.report_date = r[2]
 
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt = arcpy.Point()
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.X = r[18] #nad 27 x
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnt.Y = r[19] #nad 27 y
&amp;nbsp;&amp;nbsp;&amp;nbsp; rr.shape = pnt
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; c.insertRow(rr)

del rows, c
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:18:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322475#M25122</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2021-12-11T15:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322476#M25123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You should declare the spatial reference of the INPUT coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The cursor picks up the TARGET spatial reference from the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;quote&amp;gt; from "Setting a cursor's spatial reference":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[... source is a list of state plane coords, target is UTM...]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When you open the insert cursor on the feature class, you set its spatial reference to state plane, declaring that you want the geometries you're inserting to be converted from state plane to UTM.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;unquote&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2012 10:59:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322476#M25123</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2012-06-29T10:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: convert coordinates on the fly?</title>
      <link>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322477#M25124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;^^^ thanks for pointing that out!&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm getting closer...&amp;nbsp; Now I just need to figure out how to get the geographic transformation to be applied so I'm not 200ft off to the east!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;fixt:&amp;nbsp; arcpy.env.geographicTransformations = 'NAD_1927_To_NAD_1983_NADCON'&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Jun 2012 14:31:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/convert-coordinates-on-the-fly/m-p/322477#M25124</guid>
      <dc:creator>KevinBell</dc:creator>
      <dc:date>2012-06-29T14:31:18Z</dc:date>
    </item>
  </channel>
</rss>

