ArcGIS - How to copy and replace polygon (ONLY GEOMETRY) Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Is it possible to set the layer which the trace tool traces?Using arcpy.da.SearchCursor to script snapping one set of points to location of another set of points?How do I copy or edit a cell of attribute table and paste in text file?ArcGIS Find and Replace attribute search errorCopy Features (Data Management) and replace the new featuresLarge dataset, how to copy values between fieldsUsing Replace Geometry to replace selected feature with circle in ArcGIS Desktop?QGIS 2.10.1 Copy and Paste Problem - Attributes not showingHow to copy attributes after splitting polylines?Polygon to Polygon: new geometry, preserve attributesHow to copypaste selected field to other attribute table in ArcGIS 10.3?Creating new PostGIS table with records + geometries from another table?

Is the Standard Deduction better than Itemized when both are the same amount?

Generate an RGB colour grid

Using et al. for a last / senior author rather than for a first author

Why did the rest of the Eastern Bloc not invade Yugoslavia?

Identifying polygons that intersect with another layer using QGIS?

String `!23` is replaced with `docker` in command line

How to call a function with default parameter through a pointer to function that is the return of another function?

Can a USB port passively 'listen only'?

Why do people hide their license plates in the EU?

Why aren't air breathing engines used as small first stages

Align equal signs while including text over equalities

Extract all GPU name, model and GPU ram

Sci-Fi book where patients in a coma ward all live in a subconscious world linked together

Why did the IBM 650 use bi-quinary?

Seeking colloquialism for “just because”

How discoverable are IPv6 addresses and AAAA names by potential attackers?

Short Story with Cinderella as a Voo-doo Witch

Is there a (better) way to access $wpdb results?

What LEGO pieces have "real-world" functionality?

3 doors, three guards, one stone

How to find all the available tools in macOS terminal?

Are two submodules (where one is contained in the other) isomorphic if their quotientmodules are isomorphic?

Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?

Single word antonym of "flightless"



ArcGIS - How to copy and replace polygon (ONLY GEOMETRY)



Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Is it possible to set the layer which the trace tool traces?Using arcpy.da.SearchCursor to script snapping one set of points to location of another set of points?How do I copy or edit a cell of attribute table and paste in text file?ArcGIS Find and Replace attribute search errorCopy Features (Data Management) and replace the new featuresLarge dataset, how to copy values between fieldsUsing Replace Geometry to replace selected feature with circle in ArcGIS Desktop?QGIS 2.10.1 Copy and Paste Problem - Attributes not showingHow to copy attributes after splitting polylines?Polygon to Polygon: new geometry, preserve attributesHow to copypaste selected field to other attribute table in ArcGIS 10.3?Creating new PostGIS table with records + geometries from another table?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








5















I have two layer (A, B). I need copy polygon from layer A and replace polygon in layer B, but only geometry. I want to preserve original attribute table from layer A.










share|improve this question
























  • I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

    – Barbarossa
    Nov 25 '13 at 16:57











  • I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

    – mbuyi
    Dec 8 '17 at 8:26


















5















I have two layer (A, B). I need copy polygon from layer A and replace polygon in layer B, but only geometry. I want to preserve original attribute table from layer A.










share|improve this question
























  • I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

    – Barbarossa
    Nov 25 '13 at 16:57











  • I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

    – mbuyi
    Dec 8 '17 at 8:26














5












5








5


1






I have two layer (A, B). I need copy polygon from layer A and replace polygon in layer B, but only geometry. I want to preserve original attribute table from layer A.










share|improve this question
















I have two layer (A, B). I need copy polygon from layer A and replace polygon in layer B, but only geometry. I want to preserve original attribute table from layer A.







arcgis-desktop copy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '13 at 22:15









PolyGeo

54k1782246




54k1782246










asked Nov 25 '13 at 16:20









kocakkocak

2612




2612












  • I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

    – Barbarossa
    Nov 25 '13 at 16:57











  • I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

    – mbuyi
    Dec 8 '17 at 8:26


















  • I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

    – Barbarossa
    Nov 25 '13 at 16:57











  • I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

    – mbuyi
    Dec 8 '17 at 8:26

















I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

– Barbarossa
Nov 25 '13 at 16:57





I am confused. Are you wanting to copy geometry or attributes from A to B? What will be the difference between A and B?

– Barbarossa
Nov 25 '13 at 16:57













I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

– mbuyi
Dec 8 '17 at 8:26






I am trying to copy a geometry from one table and paste it to another but it says insufficient permission. I only want to do it for only one mining application. I don't want to digitise the entire area because it will take

– mbuyi
Dec 8 '17 at 8:26











4 Answers
4






active

oldest

votes


















7














I would consider using the arcpy.da.UpdateCursor and SHAPE@ token for representing the geometry object. First, you have iterate through the rows to find if the value in some unique ID field matches, and if yes > replace the source geometry with the target one.






share|improve this answer























  • Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

    – Homrich24
    Dec 15 '16 at 1:46












  • @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

    – Alex Tereshenkov
    Dec 15 '16 at 7:20


















4














If you are only dealing with a few polygons, I would use the Replace Geometry tool on the Advanced Editing toolbar. See http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000001s000000



Alternately for a few polygons you could copy and paste the polygon(s) into layer B and then use the attribute transfer tool on the Spatial Adjustment toolbar to copy the attributes into the copied polygon; then delete the poly to be replaced.



But if you want to do this for all or many polygons and you have ArcInfo/Advanced, you could convert the affected layer B polygons to points inside the shape (and then later delete these polygons), convert the matching layer A polygons to lines, and then build polygons using the points as attributes. Check to make sure no point on the edge of one shape in B is not in the matching A. Add these new polygons to layer B. Use copies in case of mistake. My guess is Alex's answer is the most elegant, however.






share|improve this answer























  • You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

    – ndthl
    May 11 '15 at 9:07











  • This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

    – Delonix R.
    Jun 14 '17 at 16:03


















2














As already mentioned you can use the da.UpdateCursor to update geometries. The geometries from A is stored in a Dictionary using the da.SearchCursor. The Dictionary is then used in the UpdateCursor to replace geometries where IDs match:



import arcpy

#Change to match your data:
arcpy.env.workspace = r'C:database.gdb'
A = 'featureclass1'
idfieldA = 'ID123'
B = 'featureclass2'
idfieldB = 'ID456'

#Build a dictionary with IDs as keys and geometries as value
geometries = key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])

#Empty list to store ids in B not found in A
notfound = []

#Update B with geometries from A where ID:s match
with arcpy.da.UpdateCursor(B, [idfieldB, 'SHAPE@']) as cursor:
for row in cursor:
try:
row[1] = geometries[row[0]]
cursor.updateRow(row)
except:
notfound.append(row[0])

print 'Found no id match and could not update geometry for IDs: ', notfound





share|improve this answer
































    0














    As stated there is the Replace Geometry Tool. You can also use copy/paste and another doc about copy/paste between databases. If you are comfortable with programing, the arcpy.da.search and update cursor can also do the trick.






    share|improve this answer























      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "79"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader:
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      ,
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













      draft saved

      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f78541%2farcgis-how-to-copy-and-replace-polygon-only-geometry%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7














      I would consider using the arcpy.da.UpdateCursor and SHAPE@ token for representing the geometry object. First, you have iterate through the rows to find if the value in some unique ID field matches, and if yes > replace the source geometry with the target one.






      share|improve this answer























      • Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

        – Homrich24
        Dec 15 '16 at 1:46












      • @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

        – Alex Tereshenkov
        Dec 15 '16 at 7:20















      7














      I would consider using the arcpy.da.UpdateCursor and SHAPE@ token for representing the geometry object. First, you have iterate through the rows to find if the value in some unique ID field matches, and if yes > replace the source geometry with the target one.






      share|improve this answer























      • Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

        – Homrich24
        Dec 15 '16 at 1:46












      • @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

        – Alex Tereshenkov
        Dec 15 '16 at 7:20













      7












      7








      7







      I would consider using the arcpy.da.UpdateCursor and SHAPE@ token for representing the geometry object. First, you have iterate through the rows to find if the value in some unique ID field matches, and if yes > replace the source geometry with the target one.






      share|improve this answer













      I would consider using the arcpy.da.UpdateCursor and SHAPE@ token for representing the geometry object. First, you have iterate through the rows to find if the value in some unique ID field matches, and if yes > replace the source geometry with the target one.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 25 '13 at 16:56









      Alex TereshenkovAlex Tereshenkov

      26.4k135100




      26.4k135100












      • Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

        – Homrich24
        Dec 15 '16 at 1:46












      • @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

        – Alex Tereshenkov
        Dec 15 '16 at 7:20

















      • Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

        – Homrich24
        Dec 15 '16 at 1:46












      • @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

        – Alex Tereshenkov
        Dec 15 '16 at 7:20
















      Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

      – Homrich24
      Dec 15 '16 at 1:46






      Alex I am trying to perform the operation your describe using arcpy.da.UpdateCursor and SHAPE@, but with being new to python I can't get it to work. Could you show me an example code for this with "SITE_ID" as the matching field?

      – Homrich24
      Dec 15 '16 at 1:46














      @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

      – Alex Tereshenkov
      Dec 15 '16 at 7:20





      @Homrich24, sure! Please post a new question and me or some other person will provide an answer.

      – Alex Tereshenkov
      Dec 15 '16 at 7:20













      4














      If you are only dealing with a few polygons, I would use the Replace Geometry tool on the Advanced Editing toolbar. See http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000001s000000



      Alternately for a few polygons you could copy and paste the polygon(s) into layer B and then use the attribute transfer tool on the Spatial Adjustment toolbar to copy the attributes into the copied polygon; then delete the poly to be replaced.



      But if you want to do this for all or many polygons and you have ArcInfo/Advanced, you could convert the affected layer B polygons to points inside the shape (and then later delete these polygons), convert the matching layer A polygons to lines, and then build polygons using the points as attributes. Check to make sure no point on the edge of one shape in B is not in the matching A. Add these new polygons to layer B. Use copies in case of mistake. My guess is Alex's answer is the most elegant, however.






      share|improve this answer























      • You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

        – ndthl
        May 11 '15 at 9:07











      • This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

        – Delonix R.
        Jun 14 '17 at 16:03















      4














      If you are only dealing with a few polygons, I would use the Replace Geometry tool on the Advanced Editing toolbar. See http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000001s000000



      Alternately for a few polygons you could copy and paste the polygon(s) into layer B and then use the attribute transfer tool on the Spatial Adjustment toolbar to copy the attributes into the copied polygon; then delete the poly to be replaced.



      But if you want to do this for all or many polygons and you have ArcInfo/Advanced, you could convert the affected layer B polygons to points inside the shape (and then later delete these polygons), convert the matching layer A polygons to lines, and then build polygons using the points as attributes. Check to make sure no point on the edge of one shape in B is not in the matching A. Add these new polygons to layer B. Use copies in case of mistake. My guess is Alex's answer is the most elegant, however.






      share|improve this answer























      • You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

        – ndthl
        May 11 '15 at 9:07











      • This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

        – Delonix R.
        Jun 14 '17 at 16:03













      4












      4








      4







      If you are only dealing with a few polygons, I would use the Replace Geometry tool on the Advanced Editing toolbar. See http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000001s000000



      Alternately for a few polygons you could copy and paste the polygon(s) into layer B and then use the attribute transfer tool on the Spatial Adjustment toolbar to copy the attributes into the copied polygon; then delete the poly to be replaced.



      But if you want to do this for all or many polygons and you have ArcInfo/Advanced, you could convert the affected layer B polygons to points inside the shape (and then later delete these polygons), convert the matching layer A polygons to lines, and then build polygons using the points as attributes. Check to make sure no point on the edge of one shape in B is not in the matching A. Add these new polygons to layer B. Use copies in case of mistake. My guess is Alex's answer is the most elegant, however.






      share|improve this answer













      If you are only dealing with a few polygons, I would use the Replace Geometry tool on the Advanced Editing toolbar. See http://resources.arcgis.com/en/help/main/10.1/index.html#//01m80000001s000000



      Alternately for a few polygons you could copy and paste the polygon(s) into layer B and then use the attribute transfer tool on the Spatial Adjustment toolbar to copy the attributes into the copied polygon; then delete the poly to be replaced.



      But if you want to do this for all or many polygons and you have ArcInfo/Advanced, you could convert the affected layer B polygons to points inside the shape (and then later delete these polygons), convert the matching layer A polygons to lines, and then build polygons using the points as attributes. Check to make sure no point on the edge of one shape in B is not in the matching A. Add these new polygons to layer B. Use copies in case of mistake. My guess is Alex's answer is the most elegant, however.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Nov 25 '13 at 17:49









      johnsjohns

      1,0171010




      1,0171010












      • You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

        – ndthl
        May 11 '15 at 9:07











      • This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

        – Delonix R.
        Jun 14 '17 at 16:03

















      • You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

        – ndthl
        May 11 '15 at 9:07











      • This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

        – Delonix R.
        Jun 14 '17 at 16:03
















      You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

      – ndthl
      May 11 '15 at 9:07





      You can speed up the manual process outlined here by using the Replace Geometry tool to draw a very simple rectangle around the new geometry without tracing every single one of its vertices. Then select the new geometry, hit the editor menu, go down to clip, then choose to preserve the area that intersects. Then you get all of the new geometry and preserve the attributes.

      – ndthl
      May 11 '15 at 9:07













      This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

      – Delonix R.
      Jun 14 '17 at 16:03





      This answer/tool worked great for me: I had a copy of the original polygon layer, which I made close to 300 polygon modifications (changing both attributes and polygon boundaries as well). Then I had to update my original layer (containing like 36.000 polygons), with the changes made in the copied layer. I used Replace Geometry and it did the job in a great/seamless manner. Good advice. Thanks!

      – Delonix R.
      Jun 14 '17 at 16:03











      2














      As already mentioned you can use the da.UpdateCursor to update geometries. The geometries from A is stored in a Dictionary using the da.SearchCursor. The Dictionary is then used in the UpdateCursor to replace geometries where IDs match:



      import arcpy

      #Change to match your data:
      arcpy.env.workspace = r'C:database.gdb'
      A = 'featureclass1'
      idfieldA = 'ID123'
      B = 'featureclass2'
      idfieldB = 'ID456'

      #Build a dictionary with IDs as keys and geometries as value
      geometries = key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])

      #Empty list to store ids in B not found in A
      notfound = []

      #Update B with geometries from A where ID:s match
      with arcpy.da.UpdateCursor(B, [idfieldB, 'SHAPE@']) as cursor:
      for row in cursor:
      try:
      row[1] = geometries[row[0]]
      cursor.updateRow(row)
      except:
      notfound.append(row[0])

      print 'Found no id match and could not update geometry for IDs: ', notfound





      share|improve this answer





























        2














        As already mentioned you can use the da.UpdateCursor to update geometries. The geometries from A is stored in a Dictionary using the da.SearchCursor. The Dictionary is then used in the UpdateCursor to replace geometries where IDs match:



        import arcpy

        #Change to match your data:
        arcpy.env.workspace = r'C:database.gdb'
        A = 'featureclass1'
        idfieldA = 'ID123'
        B = 'featureclass2'
        idfieldB = 'ID456'

        #Build a dictionary with IDs as keys and geometries as value
        geometries = key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])

        #Empty list to store ids in B not found in A
        notfound = []

        #Update B with geometries from A where ID:s match
        with arcpy.da.UpdateCursor(B, [idfieldB, 'SHAPE@']) as cursor:
        for row in cursor:
        try:
        row[1] = geometries[row[0]]
        cursor.updateRow(row)
        except:
        notfound.append(row[0])

        print 'Found no id match and could not update geometry for IDs: ', notfound





        share|improve this answer



























          2












          2








          2







          As already mentioned you can use the da.UpdateCursor to update geometries. The geometries from A is stored in a Dictionary using the da.SearchCursor. The Dictionary is then used in the UpdateCursor to replace geometries where IDs match:



          import arcpy

          #Change to match your data:
          arcpy.env.workspace = r'C:database.gdb'
          A = 'featureclass1'
          idfieldA = 'ID123'
          B = 'featureclass2'
          idfieldB = 'ID456'

          #Build a dictionary with IDs as keys and geometries as value
          geometries = key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])

          #Empty list to store ids in B not found in A
          notfound = []

          #Update B with geometries from A where ID:s match
          with arcpy.da.UpdateCursor(B, [idfieldB, 'SHAPE@']) as cursor:
          for row in cursor:
          try:
          row[1] = geometries[row[0]]
          cursor.updateRow(row)
          except:
          notfound.append(row[0])

          print 'Found no id match and could not update geometry for IDs: ', notfound





          share|improve this answer















          As already mentioned you can use the da.UpdateCursor to update geometries. The geometries from A is stored in a Dictionary using the da.SearchCursor. The Dictionary is then used in the UpdateCursor to replace geometries where IDs match:



          import arcpy

          #Change to match your data:
          arcpy.env.workspace = r'C:database.gdb'
          A = 'featureclass1'
          idfieldA = 'ID123'
          B = 'featureclass2'
          idfieldB = 'ID456'

          #Build a dictionary with IDs as keys and geometries as value
          geometries = key:value for (key,value) in arcpy.da.SearchCursor(A, [idfieldA, 'SHAPE@'])

          #Empty list to store ids in B not found in A
          notfound = []

          #Update B with geometries from A where ID:s match
          with arcpy.da.UpdateCursor(B, [idfieldB, 'SHAPE@']) as cursor:
          for row in cursor:
          try:
          row[1] = geometries[row[0]]
          cursor.updateRow(row)
          except:
          notfound.append(row[0])

          print 'Found no id match and could not update geometry for IDs: ', notfound






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 8 '17 at 9:32

























          answered Dec 8 '17 at 9:10









          BERABERA

          17.2k62044




          17.2k62044





















              0














              As stated there is the Replace Geometry Tool. You can also use copy/paste and another doc about copy/paste between databases. If you are comfortable with programing, the arcpy.da.search and update cursor can also do the trick.






              share|improve this answer



























                0














                As stated there is the Replace Geometry Tool. You can also use copy/paste and another doc about copy/paste between databases. If you are comfortable with programing, the arcpy.da.search and update cursor can also do the trick.






                share|improve this answer

























                  0












                  0








                  0







                  As stated there is the Replace Geometry Tool. You can also use copy/paste and another doc about copy/paste between databases. If you are comfortable with programing, the arcpy.da.search and update cursor can also do the trick.






                  share|improve this answer













                  As stated there is the Replace Geometry Tool. You can also use copy/paste and another doc about copy/paste between databases. If you are comfortable with programing, the arcpy.da.search and update cursor can also do the trick.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 9 at 16:38









                  SteveSteve

                  1,066717




                  1,066717



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f78541%2farcgis-how-to-copy-and-replace-polygon-only-geometry%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

                      Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

                      Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221