Premium DOM Component
Orthographic Earth
A world of possibilities by Read Write Tools Jan 8, 2021
Abstract |
---|
The Orthographic Earth DOM component renders an interactive map of Earth where an entire hemisphere is visible. Its viewing angle can be rotated and tilted by the user to show Earth from any point of reference. Data can be added to the map using network-friendly quantized topoJSON layers. Data points can be linked to external databases to allow users to explore spatial-based thematic patterns. Data layers can be styled using a declarative language for visual style sheets. |
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:
full.earth | Polar views the world |
timezone.earth | Interactive map of world time |
simply.earth | Political geography of the world |
Installation
Prerequisites
The rwt-orthographic-earth DOM component works in any browser that supports modern W3C standards and the W3C Web Platform Incubator Community Group's importmap proposal. Chrome provides a good implementation of the importmap proposal, other browsers can use Guy Bedford's polyfill es-module-shims.
npm install es-module-shims
The rwt-orthographic-earth DOM component has three additional dependencies, also written by Read Write Tools:
- rwt-dockable-panels
- Dockable Panels DOM component.
- softlib
- Runtime code safety and sanity checking.
- GCS I/O
- Geographic Coordinate System I/O Library.
Download using NPM
Install the component and dependencies with these commands:
npm install rwt-orthographic-earthnpm install rwt-dockable-panelsnpm install softlibnpm install gcsio
Important note: This DOM component uses Node.js and NPM and package.json
as a convenient distribution and installation mechanism. The DOM component itself does not need them.
Download using Github
If you prefer using Github, follow these steps:
- Create a
node_modules
directory in the root of your web project. - Clone the required repos into it using these commands:
git clone https://github.com/readwritetools/rwt-orthographic-earth.gitgit clone https://github.com/readwritetools/rwt-dockable-panels.gitgit clone https://github.com/readwritetools/softlib.gitgit clone https://github.com/readwritetools/gcsio.git
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.
-
geolocation
Used to set the initial latitude, longitude and place of interest. -
-
''
[default] set initial longitude, latitude and place of interest to (0.0, 0.0) and honor explicit setTangentLongitude(), setTangentLatitude(), setPlaceOfInterest(). -
'timezone'
use the browser's current time to determine the map's initial longitude. -
'auto'
use the browser's geolocation beacon to set initial longitude, latitude and place of interest.
-
-
menu-state
Used to set the initial state of the toolbar -
-
closed
[default] The toolbar menu should initially be collapsed. -
open
The toolbar menu should initially be expanded.
-
-
menu-corner
Used to position the toolbar's location relative to the component's canvas area. -
-
top-right
[default] top-left
bottom-right
bottom-left
-
-
panels
Declares the presence and order of menu panels. -
-
interaction
Mouse gestures for manipulation and interaction. -
layers
Choose which layers to display. -
locate
Display longitude and latitude of mouse position. -
discover
Discover features a pointer position. -
identify
Identify underlying feature details. -
season
Change the reference date. -
time-of-day
Change the time of day. -
point-of-reference
Change the longitude/latitude of the observation point. -
equation-of-time
The variance between mean solar noon and actual solar noon. -
solar-events
The time of sunrise, solar noon, and sunset. -
geocentric-coords
The Earth's declination and right ascension for the current date and time. -
topocentric-coords
The position of the sun for the current location and time. -
zoom
Change the map's scale. -
space
Shift the space point of view. -
canvas
Shift the canvas origin. -
time-lapse
Rotate the Earth. -
hello-world
Licensing information.
-
Life-cycle events
The component issues life-cycle events.
component-loaded
- Sent when the component is fully loaded and ready to be used. As a convenience you can use the
waitOnLoading()
method which returns a promise that resolves when thecomponent-loaded
event is received. Call this asynchronously withawait
.
Metadata
Module exports
ES modules | true |
Common JS | false |
Suitability
Browser | API |
node.js | none |
Availability
Documentation | READ WRITE HUB | |
Source code | github | |
Component catalog | DOM COMPONENTS | |
Package installation | npm | |
Publication venue | READ WRITE STACK |
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 .
JavaScript Orthographic Earth Software License Agreement
Copyright © 2022 Read Write Tools.
- This Software License Agreement ("Agreement") is a legal contract between you and Read Write Tools ("RWT"). The "Materials" subject to this Agreement include the "JavaScript Orthographic Earth" software and associated documentation.
- By using these Materials, you agree to abide by the terms and conditions of this Agreement.
- The Materials are protected by United States copyright law, and international treaties on intellectual property rights. The Materials are licensed, not sold to you, and can only be used in accordance with the terms of this Agreement. RWT is and remains the owner of all titles, rights and interests in the Materials, and RWT reserves all rights not specifically granted under this Agreement.
- Subject to the terms of this Agreement, RWT hereby grants to you a limited, non-exclusive license to use the Materials subject to the following conditions:
- You may not distribute, publish, sub-license, sell, rent, or lease the Materials.
- You may not decompile or reverse engineer any source code included in the software.
- You may not modify or extend any source code included in the software.
- Your license to use the software is limited to the purpose for which it was originally intended, and does not include permission to extract, link to, or use parts on a separate basis.
- An eBook published under a single title and author.
- A mobile app for distribution under a single app name.
- A desktop application published under a single application name.
- A website published under a single domain name. For this purpose, and by way of example, the domain names "alpha.example.com" and "beta.example.com" are considered to be separate websites.
- A load-balanced collection of web servers, used to provide access to a single website under a single domain name.
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:
export default [{ "product-key": "rwt-orthographic-earth", "registration": "example.com", "customer-number": "CN-xxx-yyyyy", "access-key": "AK-xxx-yyyyy" }]