Gismo + Heron in Rhino 8: Initialization Order Issue

Hi @djordje and @Brian_Washburn ,

I’ve been testing how Gismo and Heron can be used together in a terrain workflow, particularly for georeferencing and spatial reference in Rhino 8.

The workflow I’m exploring is:

Gismo Terrain Generator → Heron geographic/spatial reference → Gismo Terrain Analysis

For a Mt. Fuji test location (35.3606, 138.7274), I first confirmed that Gismo’s Terrain Generator internally uses EPSG:32654 — WGS 84 / UTM zone 54N.
I was also able to connect the origin from Gismo’s Terrain Generator and the latitude/longitude from the Gismo location to Heron’s Set EarthAnchorPoint. The Earth Anchor Point was correctly stored in the Rhino document and remained there after saving, closing, and reopening the .3dm file.
However, I noticed an execution-order-dependent issue when using Gismo Terrain Generator and Heron Set Spatial Reference System (SetSRS) in the same Rhino 8 session.

Case 1 — Gismo first
Gismo Terrain Generator runs correctly, but when I then run Heron SetSRS, it returns:

The type initializer for 'OSGeo.OGR.OgrPINVOKE' threw an exception.

I also tested EPSG:4326 and received the same exception, so the issue does not appear to be specific to EPSG:32654.

Case 2 — Heron first
Heron SetSRS correctly recognizes EPSG:32654 as WGS 84 / UTM zone 54N, but when I then run Gismo Terrain Generator, it returns:

Solution exception: index out of range: 0

Both components work correctly on their own.
I then found the earlier 2018 discussion about using Gismo and Heron together and the related GDAL/PInvoke issue:
Gismo and Heron matching

I retested the workaround described there in my current Rhino 8 environment.
This time I:

  1. Disabled both the main Gismo Gismo initialization component and Terrain Generator.
  2. Saved the Grasshopper definition and completely restarted Rhino 8.
  3. Opened the definition with Gismo still disabled.
  4. Ran Heron SetSRS with EPSG:32654 first.
  5. Enabled the Gismo Gismo component.
  6. Enabled Terrain Generator.
  7. Ran Terrain Analysis.

With this sequence, everything worked correctly in the same Rhino 8 session. Heron SetSRS recognized EPSG:32654, Gismo generated the Mt. Fuji terrain, the Earth Anchor Point was set correctly, and Gismo Terrain Analysis also completed successfully.

So the older workaround still appears to be effective in my current Rhino 8 setup, as long as the main Gismo Gismo initialization component is also disabled before Rhino is restarted.

I’m now curious about what is happening internally.

Does this behavior come from the order in which Gismo and Heron initialize or load their GIS runtime dependencies? Since both plugins work independently, but the behavior changes depending on their initialization order, I’m also curious whether this is the same underlying issue discussed in 2018, or whether something has changed with the current versions of Rhino, Gismo, and Heron.
I’d be very interested to hear your thoughts on what might be happening internally.

Thanks again, Djordje. Brian, if you have a chance to take a look, I’d really appreciate any perspective from the Heron side.

Kensuke Nakata

Hi @Kensuke_Nakata

I think the issue lies in Heron and Gismo trying to load different versions of GDAL libraries within Grasshopper’s single .NET app domain. Aside from the links you already provided, the issue is noted here as well:

A first step would be trying to load both Heron and Gismo from disk.

Let us know if that has any effect.

-Brian

Thanks, @Brian_Washburn

I tested this in Rhino 8 with Heron set to Load directly off the disc.

The exact test sequence was:

  1. Set Heron to Load directly off the disc in Grasshopper Settings > Solver > Plug-in Loading.
  2. Disabled Gismo Gismo, Terrain Generator, and Heron SetSRS, saved the Grasshopper definition, and completely restarted Rhino.
  3. Enabled Gismo first, then enabled Heron SetSRS → SetSRS failed.
  4. Repeated the test with Heron SetSRS enabled first, then enabled Gismo → SetSRS successfully recognized EPSG:32654, and Gismo Terrain Generator also ran successfully.

So, changing Heron from the default loading mechanism to direct disk loading did not resolve the issue. The behavior still depends on which side is initialized first.
I wasn’t able to apply the same setting to Gismo. Gismo does not appear in my Grasshopper Settings > Solver > Plug-in Loading list, so I don’t see an equivalent Load directly off the disc option for it.
As far as I understand, Gismo is installed primarily through Grasshopper User Objects rather than as a GHA listed in Plug-in Loading, so the loading mechanism may be handled differently.

@djordje ,if you have a moment, is there an equivalent way to control how Gismo — or its GIS-related dependencies — are loaded for this kind of test?

Thanks,
Kensuke Nakata

Hi @Kensuke_Nakata ,

I am afraid I do not have a better workaround from what you posted in the initial reply. Brian already provided the reason in the first link.

Nothing changed in the way Gismo loads its assemblies since 2018.

The moment Gismo Gismo component runs - it loads MapWinGIS assembly, which also has GDAL and OGR dependencies. At that moment, if you run any other Grasshopper plugin, which is using the same dependencies (as Brian pointed out - maybe different versions), an error will appear.

So I guess, you will have to go with the workaround you discovered.

Thanks again, @Brian_Washburn and @djordje

As Djordje explained, when Gismo Gismo runs, it loads the MapWinGIS assembly, which also has GDAL/OGR dependencies. However, what made the issue a little difficult to isolate was that, in my tests, running Gismo Gismo first and then enabling Heron SetSRS could still work.
So the issue seems to depend not simply on whether Gismo Gismo has been enabled, but on when the shared GIS dependencies are loaded or initialized during the workflow.
I also tested Heron with Load directly off the disc, but this did not remove the order-dependent behavior. For now, I decided not to pursue the underlying GDAL/OGR dependency conflict further.

Instead, I created a small Grasshopper Initializer. It enables Heron SetSRS first, waits for that solution to complete successfully, and then enables Gismo Gismo. After that, I can use Terrain Generator normally.

My workflow is now:

Set EarthAnchorPoint → Initialize (SetSRS → Gismo Gismo) → Terrain Generator

The original symptom appeared to be a conflict between Heron SetSRS and Gismo Terrain Generator, but this discussion helped me understand that the issue is further upstream and related to how Gismo, MapWinGIS, and the shared GDAL/OGR dependencies are initialized.
To make sure I don’t forget this sequence in future workflows, I saved the Initializer, together with SetSRS and Gismo Gismo in their initially disabled state, as a personal Grasshopper User Object. When I need to use Heron and Gismo together, I can start from this setup and add Terrain Generator afterward. This does not resolve the underlying GDAL/OGR dependency conflict, but it gives me a simple and repeatable way to avoid the initialization-order problem I encountered.

I think this is a good stopping point for now. Thanks again to both of you for helping me understand what was happening internally!

Kensuke Nakata

Hi @Kensuke_Nakata ,
You wrote the initializer as a C# file? Looks good.

I wanted to ask: what is the reason you are using Heron’s Set Spatial Reference System component?

Hi @djordje
Yes, the Initializer is a small C# script in Grasshopper!

The main reason I’m using Heron’s Set Spatial Reference System is to keep the Rhino model connected to a known spatial reference, so the workflow does not end inside Rhino.

For example, Gismo’s terrain analysis can provide useful results such as slope, aspect, elevation, or other terrain conditions. I can use those results for site selection or to inform the placement and design of a Rhino model. If the coordinate values and their spatial reference are both preserved, that resulting model can then be transferred to a 3D GIS environment or a web platform such as Cesium for further analysis, comparison with other spatial data, or visualization.

In my Mt Fuji test, Gismo internally determined EPSG:32654, so I used the same CRS in Heron to test this kind of interoperability.

So for me, SetSRS is mainly about keeping the geographic relationship explicit and reusable across Rhino, GIS, and other spatial platforms, rather than something Gismo itself requires.

If I’m misunderstanding how SetSRS should be used here, I’d be very interested to hear your thoughts.

Kensuke Nakata

Just to add one practical example of what I meant by extending the workflow beyond Rhino:

I previously tested bringing a georeferenced Rhino model into Cesium, where it could be viewed together with terrain and other geographic context:

This is the kind of interoperability I have in mind — using Rhino for modelling and analysis, while keeping the geographic relationship reusable in other GIS or web-based spatial environments!

Kensuke Nakata

Hi @Kensuke_Nakata ,

Rhino’s model in Cesium looks great! Thank you for sharing this approach!

I am certainly not an expert on Heron plugin, and Brian might correct me on this: how I understand the Heron SetSRS component: it only works for other Heron components inside Grasshopper.
Those Heron components which require SRS to be defined - SetSRS component will update them.
But it does not affect components from other Grasshopper GIS plugins (including Gismo).
Nor it affects Rhino model.

Your workflow of exporting KMZ file from Rhino to Cesium, works because you used Heron’s EarthAnchorPoint component. That’s how KMZ file knows where to position Rhino’s 3D model in Cesium. The KMZ file itself will not record any other SRS information - except the latitude and longitude, which you defined via Heron’s EarthAnchorPoint component.

Taken this into account, if you would like to export Gismo’s terrain to Cesium, just use Gismo’s Earth Anchor Point. It calls the same api that Heron’s EarthAnchorPoint does.

Hi @djordje ,

Thanks for reading the Cesium post, and for the detailed reply!

Yes, that is also how I understand the distinction. I’m not using SetSRS to set the CRS for Gismo or to embed CRS metadata into the Rhino model itself. I use SetSRS when I need Heron to import, transform, or export GIS data using a specific CRS within the same Rhino workflow.

For a simpler workflow where I only need to georeference a Rhino model and export it with geographic positioning, Earth Anchor Point alone is sufficient. I used that approach in this earlier example, exporting a Rhino model as KMZ to Google Earth Pro without SetSRS:

https://www.applicraft.com/tips/rhinoceros/rhinogis1/

The article is in Japanese, but please feel free to use browser or machine translation if helpful.

And yes, for the Rhino → KMZ → Cesium workflow, the geographic positioning comes from the Earth Anchor Point, with KML/KMZ using WGS84 longitude and latitude.

One point I should clarify is that I’m not actually planning to export Gismo’s terrain itself to a GIS environment or to Cesium. My intention is to use Gismo’s terrain analysis inside Rhino, where it can contribute to spatial intelligence by informing site selection, model placement, and design decisions.
It is the resulting Rhino model, informed by that analysis, that I may then take into a 3D GIS environment or Cesium for further use in a broader geographic context.

So for me, Gismo provides the terrain analysis, Heron provides GIS operations where a defined SRS is useful, and the Earth Anchor Point maintains the geographic relationship of the Rhino model.

@Brian_Washburn, if you have a chance, I’d be interested to know whether this matches how SetSRS is intended to be used in Heron!

Kensuke Nakata

Hi @Kensuke_Nakata , that is exactly how SetSRS is meant to be used. And to be clear, it only affects Heron components.

-Brian

Thanks, @Brian_Washburn

That confirms my understanding of SetSRS.
Really appreciate the clarification!

Kensuke Nakata