Spatial Modeler Discussions

Gain, exchange, and share knowledge, or discuss topics with other Hexagon Geospatial Product pioneers and experts to get the most out of Hexagon Geospatial products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 16
Registered: ‎10-05-2020
Accepted Solution

Exporting Spatial Modeler into Python code

Hello, 

 

Is there a way for me to take a functioning Spatial Model and export it into usuable Python code? 

 

Any suggestions would be greatly appreciated! Thanks!

Technical Evangelist
Posts: 1,121
Registered: ‎10-01-2015

Re: Exporting Spatial Modeler into Python code

Hi @Mase ,

 

If you want to automatically convert a Spatial Model to a Python Script you may wish to vote for this Idea:

 

https://community.hexagongeospatial.com/t5/Product-Ideas/Save-Spatial-Model-as-Python-script/idi-p/2...

 

In the meantime you should be able to use spatial model operators and models inside python scripts. Documentation can be found here (or in the Help installed with Spatial Modeler):

 

https://hexagongeospatial.fluidtopics.net/reader/fH0o7KrMKUViXGUeoilQuA/7ZcsiOy38Y9d76J9Nc5EiA

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Occasional Contributor
Posts: 16
Registered: ‎10-05-2020

Re: Exporting Spatial Modeler into Python code

Hello @ian.anderson , 

 

Thank you for the quick response! 

 

I'm not seeing an option to convert to a Python script when I try to 'Save As'. The only options I'm getting are .gmdx and .json. Any suggestions? 

 

Thanks, 

Mason 

Technical Evangelist
Posts: 1,121
Registered: ‎10-01-2015

Re: Exporting Spatial Modeler into Python code

Hi @Mase ,

 

As mentioned above, if you want to see an option implemented to Save As... to a Python script you should vote for the Idea so it gets implemented. The more HexPoints, the more likely it is to happen.

 

In the meantime you can use a .gmdx inside a python script, or build up a script manually using imported operators.

 

Cheers

 

Ian Anderson
Chief Product Owner, Desktop Remote Sensing
Hexagon Geospatial
Occasional Contributor
Posts: 16
Registered: ‎10-05-2020

Re: Exporting Spatial Modeler into Python code

Ahh gotcha gotcha, I understand what you were saying now. 

 

Hopefully it gets implemented in the future. Thanks for your help!