rwt-orthographic-earth
v1.0.38
Published
An orthographic projection of Earth, a standards-based DOM Component
Downloads
10
Maintainers
Readme
Premium DOM Component
Orthographic Earth
A world of possibilities
Background
All global maps suffer from distortion. This is because maps are a 2-dimensional projection of a 3-dimensional Earth. Attempts to display the entire world on a single rectangular canvas suffer more acutely than maps that are limited to just a portion of Earth at a time.
As an example, the Mercator projection exaggerates the size of the polar regions. This makes Canada, Greenland, and Russia appear much large than Africa, and turns Antarctica into an unrecognizable shape.
Another alternative — commonly used in thematic maps — is the equi-rectangular projection. It has less exaggerated areas than the Mercator projection, but still suffers because it plots each latitude without regard for the shorter longitudinal distances of the polar regions.
In contrast, the orthographic projection has faithful areas and angles near the point of perspective, with distortion occuring gradually, and only being noticable near the horizons. The primary drawback with orthographic projections in the past has been the fact that they only represent one-half of the world.
The Orthographic Earth DOM component provides an excellent alternative for cartographers who want to tell thematic stories on a global scale.
The Orthographic Earth component has these features:
- The component can be used within any HTML document.
- The drawing can be resized to fit the device's screen size, allowing it to be used on both small cell phones and large mega-pixel monitors.
- The component is self-contained, which allows for the possibility of having two or more Earth drawings appear side-by-side on the same page.
- The user interface supports both touchscreen and mouse gestures for scaling, translation, rotation and tilt.
- Users can locate and identify features by pointing to them.
- Webmasters can use the component's event-based interface to monitor user interactions, allowing synchronization with other parts of the HTML page.
- Features can be styled using a declarative visual stylesheet language.
Data layers can use sources with any of these supported formats. See GCS I/O for more about these formats. See Better Compression of GIS Features for optimization techniques.
- gfe - Geographic Feature Encoding
- ice - Indexed Coordinate Encoding
- tae - Topological Arc Encoding
- gfebin - Geographic Feature Encoding binary
- icebin - Indexed Coordinate Encoding binary
- taebin - Topological Arc Encoding binary
- geojson - RFC 7946
- topojson - (Specification )
In the wild
To see examples of this component in use, visit any of these:
Installation
Using the component
After installation, you need to add three things to your HTML page to make use of it:
- Add an
importmap
and ascript
tag to load the component and its dependencies:
<script src='/node_modules/es-module-shims/dist/es-module-shims.js' async></script>
<script type=importmap-shim>
{
"imports": {
"gcsio/": "/node_modules/gcsio/",
"softlib/": "/node_modules/softlib/",
"rwt-dockable-panels/": "/node_modules/rwt-dockable-panels/"
}
}
</script>
<script src='/node_modules/rwt-orthographic-earth/rwt-orthographic-earth.js' type=module-shim></script>
Add the component tag somewhere on the page.
- For scripting purposes, apply an
id
attribute. - For WAI-ARIA accessibility apply a
role=contentinfo
attribute.
- For scripting purposes, apply an
<rwt-orthographic-earth id=earth1 role=contentinfo></rwt-orthographic-earth>
- Listen for the component to be fully loaded before programmatically configuring its layers, stylesheets, and initial settings. Here's an example:
<script type=module-shim>
var earth1 = document.getElementById('earth1');
var promise = earth1.waitOnLoading();
promise.then(() => {
addLayers(earth1);
configure(earth1);
});
function addLayers(earth1) {
earth1.addVisualizationStyleSheet('/vss/earth1-styles.vss');
earth1.addMapItem({ layerType:'space', vssIdentifier: 'space', layerName: 'Space' });
earth1.addMapItem({ layerType:'sphere', vssIdentifier: 'sphere', layerName: 'Oceans' });
earth1.addMapItem({ layerType:'graticule', vssIdentifier: 'graticule-3-by-3',layerName: 'Graticule', meridianFrequency:3, parallelFrequency:3, drawToPoles:false });
earth1.addMapItem({ layerType:'gcs-package', vssIdentifier: 'land-110m', layerName: 'Land', url:'/natural-earth/land-110m.geojson', featureKey:'name' });
}
function configure(earth1) {
earth1.setLatitude(12.98);
earth1.setLongitude(77.58);
earth1.setRotationSpeed(-1);
}
</script>
Configure the Component
The component can be configured by adding any of these optional attributes to
the <rwt-orthographic-earth>
element tag.
Life-cycle events
The component issues life-cycle events.
Metadata
Module exports
Suitability
Availability
License
The rwt-orthographic-earth DOM component is not freeware. After evaluating it and before using it in a public-facing website, eBook, mobile app, or desktop application, you must obtain a license from Read Write Tools .
Activation
To activate your license, copy the rwt-registration-keys.js
file to the root
directory of your website, providing the customer-number
and access-key
sent to
your email address, and replacing example.com
with your website's hostname.
Follow this example: