Limit feature class parameter to specific gdb?Is it possible to run a search cursor on a multipart feature...

Taking an academic pseudonym?

Coworker is trying to get me to sign his petition to run for office. How to decline politely?

Is "accuse people to be racist" grammatical?

Performance and power usage for Raspberry Pi in the Stratosphere

Buying a "Used" Router

What can I do to encourage my players to use their consumables?

What could cause an entire planet of humans to become aphasic?

Is it possible to detect 100% of SQLi with a simple regex?

How to know if I am a 'Real Developer'

Process substitution inside a subshell to set a variable

Are all power cords made equal?

Dealing with an internal ScriptKiddie

Crack the bank account's password!

Is this Article About Possible Mirrored Universe Junk Science?

Probability X1 ≥ X2

Is the UK legally prevented from having another referendum on Brexit?

Is Screenshot Time-tracking Common?

What is wrong with my use of "find -print0"?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

Is it possible to methodically find the total of ways to read a given phrase making a stack?

Why write a book when there's a movie in my head?

User input happy birthday program

What if I miss a connection and don't have money to book next flight?

Can you say "leftside right"?



Limit feature class parameter to specific gdb?


Is it possible to run a search cursor on a multipart feature class?Copying polygon features with WHERE clause using arcpy.da?Use arcpy to check whether feature class geometry has ZMUpdating a feature class based on evaluating different fields with arcpy.da.UpdateCursorDelete records in feature class that have same ID in CSV table using arcpy cursorsWriting attributes and associated feature class name from file geodatabase to CSV?Iterating through a Feature ClassSetting up where_clause to select counties one at a time from feature class using ArcPy?Updating a row in a feature class from another feature classAppending polygon features from file geodatabase table to SDE table?













0















I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier.



It works great but the way I have it set up, you have to first select the gdb holding the two feature classes, then select each feature class.



Is there a way, once the gdb (which defines the workspace) is selected, to then limit the options for the two feature class parameters to those found in the selected gdb?



When I run it, I know they have to be in the same gdb, but I'd like to share it with colleagues as a tool and I'd like it to be at least a little fool-proof, consindering it was fool-made.



Here's the code:



import arcpy

arcpy.env.workspace = arcpy.GetParameterAsText(0)
UpdateData = arcpy.GetParameterAsText(1)
UpdateField = arcpy.GetParameterAsText(2)
ProjectData = arcpy.GetParameterAsText(3)
ProjectField = arcpy.GetParameterAsText(4)

geometries = {key:value for (key,value) in arcpy.da.SearchCursor(UpdateData, [UpdateField, 'SHAPE@'])}

notfound = []

with arcpy.da.UpdateCursor(ProjectData, [ProjectField, 'SHAPE@']) as cursor:
for row in cursor:
try:
row[1] = geometries[row[0]]
cursor.updateRow(row)
except:
notfound.append(row[0])


GUI Screenshot









share







New contributor




Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0















    I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier.



    It works great but the way I have it set up, you have to first select the gdb holding the two feature classes, then select each feature class.



    Is there a way, once the gdb (which defines the workspace) is selected, to then limit the options for the two feature class parameters to those found in the selected gdb?



    When I run it, I know they have to be in the same gdb, but I'd like to share it with colleagues as a tool and I'd like it to be at least a little fool-proof, consindering it was fool-made.



    Here's the code:



    import arcpy

    arcpy.env.workspace = arcpy.GetParameterAsText(0)
    UpdateData = arcpy.GetParameterAsText(1)
    UpdateField = arcpy.GetParameterAsText(2)
    ProjectData = arcpy.GetParameterAsText(3)
    ProjectField = arcpy.GetParameterAsText(4)

    geometries = {key:value for (key,value) in arcpy.da.SearchCursor(UpdateData, [UpdateField, 'SHAPE@'])}

    notfound = []

    with arcpy.da.UpdateCursor(ProjectData, [ProjectField, 'SHAPE@']) as cursor:
    for row in cursor:
    try:
    row[1] = geometries[row[0]]
    cursor.updateRow(row)
    except:
    notfound.append(row[0])


    GUI Screenshot









    share







    New contributor




    Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0








      I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier.



      It works great but the way I have it set up, you have to first select the gdb holding the two feature classes, then select each feature class.



      Is there a way, once the gdb (which defines the workspace) is selected, to then limit the options for the two feature class parameters to those found in the selected gdb?



      When I run it, I know they have to be in the same gdb, but I'd like to share it with colleagues as a tool and I'd like it to be at least a little fool-proof, consindering it was fool-made.



      Here's the code:



      import arcpy

      arcpy.env.workspace = arcpy.GetParameterAsText(0)
      UpdateData = arcpy.GetParameterAsText(1)
      UpdateField = arcpy.GetParameterAsText(2)
      ProjectData = arcpy.GetParameterAsText(3)
      ProjectField = arcpy.GetParameterAsText(4)

      geometries = {key:value for (key,value) in arcpy.da.SearchCursor(UpdateData, [UpdateField, 'SHAPE@'])}

      notfound = []

      with arcpy.da.UpdateCursor(ProjectData, [ProjectField, 'SHAPE@']) as cursor:
      for row in cursor:
      try:
      row[1] = geometries[row[0]]
      cursor.updateRow(row)
      except:
      notfound.append(row[0])


      GUI Screenshot









      share







      New contributor




      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier.



      It works great but the way I have it set up, you have to first select the gdb holding the two feature classes, then select each feature class.



      Is there a way, once the gdb (which defines the workspace) is selected, to then limit the options for the two feature class parameters to those found in the selected gdb?



      When I run it, I know they have to be in the same gdb, but I'd like to share it with colleagues as a tool and I'd like it to be at least a little fool-proof, consindering it was fool-made.



      Here's the code:



      import arcpy

      arcpy.env.workspace = arcpy.GetParameterAsText(0)
      UpdateData = arcpy.GetParameterAsText(1)
      UpdateField = arcpy.GetParameterAsText(2)
      ProjectData = arcpy.GetParameterAsText(3)
      ProjectField = arcpy.GetParameterAsText(4)

      geometries = {key:value for (key,value) in arcpy.da.SearchCursor(UpdateData, [UpdateField, 'SHAPE@'])}

      notfound = []

      with arcpy.da.UpdateCursor(ProjectData, [ProjectField, 'SHAPE@']) as cursor:
      for row in cursor:
      try:
      row[1] = geometries[row[0]]
      cursor.updateRow(row)
      except:
      notfound.append(row[0])


      GUI Screenshot







      arcpy





      share







      New contributor




      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share







      New contributor




      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share



      share






      New contributor




      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 mins ago









      DanteDante

      1




      1




      New contributor




      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Dante is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          0






          active

          oldest

          votes











          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
          });


          }
          });






          Dante is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313350%2flimit-feature-class-parameter-to-specific-gdb%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Dante is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          Dante is a new contributor. Be nice, and check out our Code of Conduct.













          Dante is a new contributor. Be nice, and check out our Code of Conduct.












          Dante is a new contributor. Be nice, and check out our Code of Conduct.
















          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%2f313350%2flimit-feature-class-parameter-to-specific-gdb%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

          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

          Meter-Bus Содержание Параметры шины | Стандартизация |...