4

This link illustrates one method for calling python scripts from within an ArcObjects environment. The results of these tasks are returned as strings. I wonder if it is possible to call a python script and pass objects back and forth.

For example, assume I have defined a 2-dimensional array (in VB.Net) of x,y coordinate pairs. I want to pass this object to a .py script that will perform some computation (doesn't matter what really) and return a dictionary of lists, i.e. {"1":[2,3,4], "2":[1,3,4], "8":[9,11,5]}.

4

As far as I know, there is no way to pass objects between .net and python, but you can use a common data structure like JSON to pass data in string form back and forth and restructure using something like JSON.NET which has a method of deserializing the raw JSON string into a dictionary. It should be easy to find a library that does this on the python end as well. Here's a usage example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.