Globe Geometry Features from GeoJson Files
As of version 0.19.0, OpenSpace includes support for drawing geometry features on a globe based on files in the GeoJson file format. GeoJson is a format for encoding geographic data structures based on 2D or 3D geographic coordinates, with latitude, longitude and an optional altitude. It supports shapes like points, lines and polygons.
Some examples of features are shown below (polygons, points with textures, and lines).
It is also possible to change the appearance of the resulting features based on some predefined available properties, either in the GeoJson file itself or in OpenSpace. See the builder page Adding Geometry with GeoJson for more details on available settings and properties.
Adding GeoJson features to a globe
There are two ways of adding GeoJson features to a selected globe: either directly from a .geojson file or by specifying a table in an OpenSpace asset. Once added, all content in a GeoJson file will appear as a component under “GeoJson” in the scene menu, as part of the globe it was added to.
Using a GeoJson asset
The preferred way to load a GeoJson file is to load it from an asset. This lets you add it to the correct globe already at startup. Adding GeoJson to a globe through an asset works very similarly to how a GlobeBrowsing Layer is added. Some example assets are available in the data/assets/examples/geojson
folder of your OpenSpace installation.
Using an asset also lets you customize the visual properties of all the rendered features that do not have any properties specified in the GeoJson file. See page Adding Geometry with GeoJson for more details on how to create an asset for a GeoJson file.
Add directly from a file, using drag and drop
If the current focus node is a globe, you can also drag and drop a GeoJson file in the OpenSpace window to add it to the currently focused node. The file’s features will then be added with default values for all properties not included in the file.
Automatic flying to a feature
It is possible to fly to a GeoJson feature using the Scene menu. Each component, and the individual Features in a component, has a “Fly to feature” button that will trigger a camera path to that feature, framing it based on its latitude and longitude coordinates.
Deleting a loaded GeoJson layer
The more geojson layers are drawn, the worse the performance may be. In cases of bad performance, deleting, or simply disabling, some GeoJson layers may improve the situation. This can be done using the openspace.globebrowsing.deleteGeoJson(globe, geoJsonIdentifier)
Lua command. The geoJsonIdentifier
is the identifier of the geoJson object, and globe
is the identifier of the globe the GeoJson feature belongsa to (e.g. “Earth”).
Note that after deleting a GeoJson component, the user interface has to be reloaded for the change to be reflected in the interface. The default keybinding for doing this is F5.
Known issues
The GeoJson support implemented in 0.19.0 is a first iteration and may be subject to changes in the future. It also includes some known issues that we intend to fix down the line. Here is a summary of those issues:
The performance of the rendering is suffering when a feature consists of a lot of triangles, or when loading files with lots of features
The motion generated by the “fly to” feature is currently a bit weird when flying between things on a planet surface. This will be improved in the future.