Select to view content in your preferred language

Unable to export all feature from a polyline feature Class

279
4
05-13-2024 10:33 PM
ArchitGIS
New Contributor II

Hello Team,

I have created a Script tool in ArcGIS Pro using Python which should allow us to do the following:

  • Takes two points input from the user let's say "Start point" and "End point".
  • Export all the features and attributes between start and end to the output feature class.
  • Change the value of an attribute "IsConnected" from "True" to "False" in Output.
  • Make sure all the features between the two drawn points are exported correctly without any issues.

However, it does not export the data as needed, the behavior it shows as follows:

  • If the number of lines between the two drawn points is one line : Works Successfully
  • If the number of line feature are more than one between the two drawn points is one line 
    • Exported attribute table shows all the data which falls between the drawn inputs
    • Doesn't show all the features on exported features on Map, only few show up.
  • Input method 

          Input.png

  • Result

         Result.png

  • All the attribute data between "Start point" and "end point" is visible in Output but when I try to draw that on the map, it draw only which is shows in selected above

         ArchitSrivaGIS_0-1715664454683.png

The logical approach taken for this in script:

  1. Draw two points on the map.
  2. Create a line geometry connecting the two points.
  3. Buffer the line geometry to create a search area.
  4. Select all polyline features that intersect with the buffer zone.
  5. Export the selected features to the output feature class.
  6. Change the value of the "IsConnected" field to "False" for the exported features.

Script used : Will attach if needed

As of no, I am unsure of what could be going wrong. It would be really helpful if anyone can share some thought on this or maybe let me know if I missed something or if there is an easier approach to achieve this.

0 Kudos
4 Replies
Clubdebambos
Occasional Contributor III

Hi @ArchitGIS 

It would be beneficial to see the script to see how the code matches your logical steps.

~ learn.finaldraftmapping.com
0 Kudos
ArchitGIS
New Contributor II

Hello @Clubdebambos ,

Thanks for the response. I am unable to attach the files for some reason. Hence, uploaded it to files share

URL  : https://uploadnow.io/f/JkMM4L9 

File name : last_working_tool.zip

Also, a screenshot of the ArcGIS pro parameters:

ArchitGIS_0-1715682071050.png

 

Clubdebambos
Occasional Contributor III

Hi @ArchitGIS 

Your code worked fine for me when selecting all lines between two points. There was an issue if the Map was in a different projection that the layer itself.

~ learn.finaldraftmapping.com
0 Kudos
ArchitGIS
New Contributor II

Hello @Clubdebambos ,

Thanks for checking this. That's an interesting find, I will test with different projections and hopefully that's the reason on my side as well.

Will share the test results soon.