<?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: shifting features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642596#M50079</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's my fault. Move the function above the call to the function and it should work. I edited my post above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, just a note about your script, you set a value of 100 for x and y shift, and then set both to None in the function definition. So, I would not expect any shift to be observed as it is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jan 2015 23:08:26 GMT</pubDate>
    <dc:creator>DarrenWiens2</dc:creator>
    <dc:date>2015-01-15T23:08:26Z</dc:date>
    <item>
      <title>shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642593#M50076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am totally new to script writing and am trying to get the Shifting Features code to work from ArcPy Café.&amp;nbsp; I can't see what I am doing wrong.&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-1" src="https://community.esri.com/legacyfs/online/51214_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 17:05:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642593#M50076</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2015-01-15T17:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642594#M50077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to actually call the shift_features function. As it is, the script executes line 1, then executes line 3, then stops. Everything between 'def' and 'return' is a function just waiting to be called. Your script should look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
in_features = r"C:/Temp/CP_C06.shp"
x_shift = 20 # may as well shift by some number
y_shift = 50 # ditto

def shift_features(in_features, x_shift, y_shift):
&amp;nbsp; with arcpy.da_UpdateCursor(in_features, ['SHAPE@XY']) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (x_shift or 0), row[0][1] + (y_shift or 0)]])
&amp;nbsp; return

shift_features(in_features, x_shift, y_shift)
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, please read "&lt;A _jive_internal="true" href="https://community.esri.com/people/curtvprice/blog/2014/09/25/posting-code-blocks-in-the-new-geonet" target="_blank"&gt;Posting Code Blocks in the New GeoNet&lt;/A&gt;" so we can copy/paste your code to help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:18:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642594#M50077</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T03:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642595#M50078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14213633283185195" jivemacro_uid="_14213633283185195"&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;Using PythonWin gives me the following error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NameError: name 'shift_features' is not defined.&amp;nbsp; Below is the code that I used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;in_features = r"C:/Temp/CP_C06.shp"&lt;BR /&gt;x_shift = 100&lt;BR /&gt;y_shift = 100&lt;BR /&gt;shift_features(in_features, x-shift, y_shift)&lt;/P&gt;&lt;P&gt;def shift_features (in_features, x_shift=None, y_shift=None):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY']) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (x_shift or 0),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0][1] + (y_shift or 0)]])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14213633552219258 jive_text_macro" jivemacro_uid="_14213633552219258"&gt;&lt;P&gt;&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:03:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642595#M50078</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2015-01-15T23:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642596#M50079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's my fault. Move the function above the call to the function and it should work. I edited my post above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, just a note about your script, you set a value of 100 for x and y shift, and then set both to None in the function definition. So, I would not expect any shift to be observed as it is.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:08:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642596#M50079</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-01-15T23:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642597#M50080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That totally did the trick.&amp;nbsp; Thanks for helping the newbie.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:15:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642597#M50080</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2015-01-15T23:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642598#M50081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;nice...Darren...although it would be wise to recommend that users experiment on a temporary file or use copyfeatures_management to clone an existing one prior to doing anything with shape geometry...a bad change in geometry can render a file useless&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:15:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642598#M50081</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-01-15T23:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642599#M50082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I figure if you're clever enough to play around with Python, you should be clever enough to make a backup or suffer the consequences.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642599#M50082</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2015-01-15T23:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642600#M50083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hahaha ... you have never taught then &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2015 23:30:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642600#M50083</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-01-15T23:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642601#M50084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Darren.&amp;nbsp; What if I want to pull the x-shift value and y-shift value from a field in my shapefile instead of putting a value into the code sequence?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 15:41:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642601#M50084</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2015-04-14T15:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642602#M50085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can access field values by including them in the UpdateCursor. The list, ['SHAPE@XY','X_SHIFT','Y_SHIFT'] (change X_SHIFT and Y_SHIFT to your field names), translates to row[0], row[1], and row[2], respectively.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
in_features = r"C:/Temp/CP_C06.shp"

def shift_features(in_features):
&amp;nbsp; with arcpy.da_UpdateCursor(in_features, ['SHAPE@XY','X_SHIFT','Y_SHIFT']) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (row[1] or 0), row[0][1] + (row[2] or 0)]])
&amp;nbsp; return

shift_features(in_features)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:18:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642602#M50085</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-12T03:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642603#M50086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I am just not getting it.&amp;nbsp; I have two fields.&amp;nbsp; One is called x_shift and one is called y_shift.&amp;nbsp; Both float fields.&amp;nbsp; Each currently have a value of 200.&amp;nbsp; I keep getting an error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
in_features = r"C:/Temp/CP_C06.shp"
def shift_features (in_features):
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(in_features, ['SHAPE@XY','x_shift','y_shift']) as cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (row[1] or 0), row[0][1] + (row[2] or 0)]])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return
shift_features(in_features)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:18:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642603#M50086</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2021-12-12T03:18:34Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642604#M50087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EDIT&lt;/P&gt;&lt;P&gt;Never mind...need the error message please&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 18:06:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642604#M50087</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-04-14T18:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642605#M50088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Student\Script_fieldname.py", line 13, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; shift_features(in_features)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Student\Script_fieldname.py", line 9, in shift_features&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (row[1] or 0), row[0][1] + (row[2] or 0)]])&lt;/P&gt;&lt;P&gt;TypeError: sequence size must match size of the row&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on a project that, in the past, I ran a move calculation [SHAPE].Move([fieldname],0) in arc3.3.&amp;nbsp; I work in ArcGIS 10, but use the oldie for a couple of tasks.&amp;nbsp; We have upgraded and now don't have the use of arc3.3 anymore.&amp;nbsp; I need to find a (modern) way to shift polygon features way out of their original spatial placement and then back again.&amp;nbsp; Arcpy Café "shifting features" coding looked promising, but way out of my wheelhouse.&amp;nbsp; So I am here begging for help.&amp;nbsp; I did some Python tutorials, but am just not getting it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Wendy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Apr 2015 18:25:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642605#M50088</guid>
      <dc:creator>WendyRolston</dc:creator>
      <dc:date>2015-04-14T18:25:30Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642606#M50089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;I am trying to shift points using the function &lt;SPAN&gt;shift_features&lt;/SPAN&gt;, but i am getting this error:&lt;/P&gt;&lt;P&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 10, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 5, in shift_features&lt;BR /&gt;AttributeError: 'module' object has no attribute 'da_UpdateCursor'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy &amp;nbsp;&lt;BR /&gt;in_features =r"B14_20140416_Mornings_UTM32" &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;def shift_features(in_features): &amp;nbsp;&lt;BR /&gt;&amp;nbsp; with arcpy.da_UpdateCursor(in_features, ['SHAPE@XY','NEAR_X','NEAR_Y']) as cursor: &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([[row[0][0] + (row[1] or 0), row[0][1] + (row[2] or 0)]]) &amp;nbsp;&lt;BR /&gt;&amp;nbsp; return &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;shift_features(in_features)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am working on a FileGDB with ArcGIS 10.3&lt;/P&gt;&lt;P&gt;NEAR_X and NEAR_Y are attributes of B14_20140416_Mornings_UTM32" &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 20:50:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642606#M50089</guid>
      <dc:creator>AngelaBlanco</dc:creator>
      <dc:date>2017-02-09T20:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642607#M50090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got a new error:&lt;/P&gt;&lt;P&gt;Runtime error &lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 7, in &amp;lt;module&amp;gt;&lt;BR /&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 4, in shift_features&lt;BR /&gt;TypeError: sequence size must match size of the row&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 20:56:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642607#M50090</guid>
      <dc:creator>AngelaBlanco</dc:creator>
      <dc:date>2017-02-09T20:56:28Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642608#M50091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Angela, it is working from a table in arcmap and not a file on disc and you need the associated other fields in the table besides the shapefield.&amp;nbsp; You would provide the function with the layer's name in the shift_features call, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:08:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642608#M50091</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-02-09T21:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642609#M50092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank Dan for the quick answer. Could you provide me an example what I should include?&lt;/P&gt;&lt;P&gt;in_features ="B14_20140416_Mornings_UTM32" is a FeatureClass with points. It contains the Attributes NEAR_X and NEAR_Y. &lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Angela&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Feb 2017 21:30:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642609#M50092</guid>
      <dc:creator>AngelaBlanco</dc:creator>
      <dc:date>2017-02-09T21:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642610#M50093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Angela... to be on the safe side, I hate messing with existing geometry...&lt;/P&gt;&lt;P&gt;Since your data are in a table already, then it would be far safer to add 2 new fields New_X and New_Y (double) and simply use the field calculator to calculate new values for the point in those fields then use File,Add data, add XY data just like you would for any event theme. (ie New_X would equal !SHAPE! + !Your_X_Shift_Field! ... and similarly for Y&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/manage-data/tables/calculate-field-examples.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;field calculator example &lt;/A&gt;which could be modified, if you want to experiment... on a copy... NOTE, totally untested so work on a copy of the file... making my original suggestion even better... but give it a try later when you have time or want to experiment.&lt;/P&gt;&lt;P&gt;Let me know if it works, It will be some time before I am on an Arc* machine.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;# code block... python parser&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;def&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;shape_shifter&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shape&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; shift_x&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; shift_y&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"""provide the shift_x and shift_y fields"""&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; point &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; shape&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getPart&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; point&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;X &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; shift_X
&amp;nbsp;&amp;nbsp;&amp;nbsp; point&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Y &lt;SPAN class="operator token"&gt;+=&lt;/SPAN&gt; shift_Y
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; point

&lt;SPAN class="comment token"&gt;# expression box...&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# shape_shifter(!SHAPE!, !X_shift_fld!, !Y_shift_fld!)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# presumably on the Shape field in the field calculator&lt;/SPAN&gt;
&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;that can be modified&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:18:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642610#M50093</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2021-12-12T03:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: shifting features</title>
      <link>https://community.esri.com/t5/python-questions/shifting-features/m-p/642611#M50094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan,&lt;/P&gt;&lt;P&gt;I created the new fields how you mencioned and the calculated the new position for every point. Then I used arcpy.MakeXYEventLayer_management and saved it in a new feature.&lt;/P&gt;&lt;P&gt;Now it works.&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ángela&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Feb 2017 14:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/shifting-features/m-p/642611#M50094</guid>
      <dc:creator>AngelaBlanco</dc:creator>
      <dc:date>2017-02-10T14:57:25Z</dc:date>
    </item>
  </channel>
</rss>

