Wondering what’s next for npm?Check out our public roadmap! »

    rwt-orthographic-earth

    1.0.24 • Public • Published

    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.
    • Data can be added to the map using topoJSON packages having points, lines or polygons.
    • 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.

    In the wild

    To see examples of this component in use, visit any of these:

    joe.earth JavaScript Orthographic Earth
    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. It has one dependency: the open-source rwt-dockable-panels component, also written by Read Write Tools.

    Download

    Download using NPM

    OPTION 1: Familiar with Node.js and the package.json file?
    Great. Install the component with this command:

    npm install rwt-orthographic-earth	

    OPTION 2: No prior experience using NPM?
    Just follow these general steps:

    • Install Node.js/NPM on your development computer.
    • Create a package.json file in the root of your web project using the command:
    npm init		
    Download and install the DOM component using the command:
    npm install rwt-orthographic-earth		

    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 directly, simply follow these steps:

    • Create a node_modules directory in the root of your web project.
    • Clone the rwt-orthographic-earth and rwt-dockable-panels DOM components into it using the command:
    git clone https://github.com/readwritetools/rwt-orthographic-earth.gitgit clone https://github.com/readwritetools/rwt-dockable-panels.git		

    Using the component

    After installation, you need to add three things to your HTML page to make use of it:

    1. Add a script tag to load the component's rwt-orthographic-earth.js file:
    <script src='/node_modules/rwt-orthographic-earth/rwt-orthographic-earth.js' type=module></script>             
    1. Add the component tag somewhere on the page.

      • For scripting purposes, apply an id attribute.
      • For WAI-ARIA accessibility apply a role=contentinfo attribute.
    <rwt-orthographic-earth id=earth1 role=contentinfo></rwt-orthographic-earth>
    1. Listen for the component to be fully loaded before programmatically configuring its layers, stylesheets, and initial settings. Here's an example:
    <script type=module>
         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.addLayer({ layerType:'space', id:'space', layerName: 'Space' });
            earth1.addLayer({ layerType:'sphere', id:'sphere', layerName: 'Oceans' });
            earth1.addLayer({ layerType:'graticule', id:'graticule-3-by-3',layerName: 'Graticule',  meridianFrequency:3, parallelFrequency:3, drawToPoles:false });
            earth1.addLayer({ layerType:'topojson-package', id:'land-110m', layerName: 'Land', url:'/natural-earth/land-110m.topojson', embeddedName:'land-110m', featureKey:'name' });
         }
         
         function configure(earth1) {
            earth1.setLatitude(12.98);
            earth1.setLongitude(77.58);
            earth1.setRotationSpeed(-1);
        }
    </script>
            

    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 the component-loaded event is received. Call this asynchronously with await.

    Reference

    DOM components logo Documentation READ WRITE HUB
    git logo Source code github
    DOM components logo Component catalog DOM COMPONENTS
    npm logo Package installation npm
    Read Write Stack logo 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
    1. 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.
    2. By using these Materials, you agree to abide by the terms and conditions of this Agreement.
    3. 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.
    4. 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.
    Each paid license allows use of the Materials under one "Fair Use Setting". Separate usage requires the purchase of a separate license. Fair Use Settings include, but are not limited to: eBooks, mobile apps, desktop applications and websites. The determination of a Fair Use Setting is made at the sole discretion of RWT. For example, and not by way of limitation, a Fair Use Setting may be one of these:
    • 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.
    THE MATERIALS ARE PROVIDED BY READ WRITE TOOLS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL READ WRITE TOOLS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This license is effective for a one year period from the date of purchase or until terminated by you or Read Write Tools. Continued use, publication, or distribution of the Materials after the one year period, under any of this Agreement's Fair Use Settings, is subject to the renewal of this license. Products or services that you sell to third parties, during the valid license period of this Agreement and in compliance with the Fair Use Settings provision, may continue to be used by third parties after the effective period of your license. If you decide not to renew this license, you must remove the software from any eBook, mobile app, desktop application, web page or other product or service where it is being used. Without prejudice to any other rights, RWT may terminate your right to use the Materials if you fail to comply with the terms of this Agreement. In such event, you shall uninstall and delete all copies of the Materials. This Agreement is governed by and interpreted in accordance with the laws of the State of California. If for any reason a court of competent jurisdiction finds any provision of the Agreement to be unenforceable, that provision will be enforced to the maximum extent possible to effectuate the intent of the parties and the remainder of the Agreement shall continue in full force and effect.

    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"
    }]
    

    Install

    npm i rwt-orthographic-earth

    DownloadsWeekly Downloads

    51

    Version

    1.0.24

    License

    see license.blue

    Unpacked Size

    369 kB

    Total Files

    62

    Last publish

    Collaborators

    • avatar