Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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]}.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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