AnsweredAssumed Answered

Trying to create a GP script in python without joining tools together in a model....

Question asked by gcooke76 on Mar 6, 2017
Latest reply on Mar 8, 2017 by gcooke76

hi,

 

I recently posted this thread in the geoprocessing forum with not much response.

 

I have tried to soldier on but keep hitting issues. Everything I know about Geoprocessing and Python I have hacked together from google searches.

 

Would someone please be able to take a look at my script here and see where it is going wrong? In short I am trying to test my theory that I can pass in an XY and a list of id's as two parameters. then create a point based on the xy and a select on my feature class where the id's are equal to the id's passed in and then use the result of the above 2 operations as inputs for a call to the "generatenear" tool to get the distances from my XY to all the selected features. I'm sure this should be pretty straight forward but my python skills aren't up to the challenge.

 

I have tried to use the in_memory workspace and this seems to be the cause of most of my problems! I have hardcoded the values for the origin point and some feature id's but in the real version these would need to be passed in parameters from a call to the python script. The intent is to publish the script as a GP tool so it can be consumed via REST by one of our company websites. Some pointers, links to relevant tutorials info etc.. would be greatly appreciated:

 

I appreciate you guys aren't going to write the code for me, but I am struggling a fair bit. Am I far off? I don't get any errors but the output in the IDLE debugger window is:

 

working
all done
None

 

How do I check if there is something in myOutput and how would I expose this so it can be consumed by a REST get operation?

Outcomes