GithubHelp home page GithubHelp logo

chengjingfeng / harp.gl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heremaps/harp.gl

0.0 2.0 0.0 101.71 MB

harp.gl - web map rendering engine

Home Page: https://heremaps.github.io/harp.gl/

License: Apache License 2.0

TypeScript 97.01% JavaScript 2.24% HTML 0.63% Shell 0.12%

harp.gl's Introduction

harp.gl Build Status

harp.gl is an experimental and work in progress open-source 3D map rendering engine.

Overview

You can use this engine to:

  • Develop visually appealing 3D maps
  • Create highly animated and dynamic map visualization with WebGL, using the popular three.js library.
  • Create themeable maps, with themes that can change on the fly.
  • Create a smooth map experience with highly performant map rendering and decoding. Web workers parallelize the CPU intensive tasks, for optimal responsiveness.
  • Design your maps modularly, where you can swap out modules and data providers as required.

With that in mind, we have included some modules that let's you get started with some simple web applications that can display a map using our default style. You can get results like the one shown below:

New York City rendered with our default style

Getting started with harp.gl

You can consume the harp.gl api with two different methods:

  • linking a simple bundle as a <script> tag in your html
  • installing a set of node modules from npm

If you want to learn more about the applications you can create, please check the Getting Started Guide.

Simple bundle

Add three.js and harp.gl to your html and create a canvas with an id map:

<html>
   <head>
      <style>
         body, html { border: 0; margin: 0; padding: 0; }
         #map { height: 100vh; width: 100vw; }
      </style>
      <script src="https://unpkg.com/three/build/three.min.js"></script>
      <script src="https://unpkg.com/@here/harp.gl/dist/harp.js"></script>
   </head>
   <body>
      <canvas id="map"></canvas>
      <script src="index.js"></script>
   </body>
</html>

Initialize the map:

const map = new harp.MapView({
   canvas: document.getElementById("map"),
   theme: "https://unpkg.com/@here/harp-map-theme@latest/resources/berlin_tilezen_night_reduced.json",
});
const controls = new harp.MapControls(map);
const omvDataSource = new harp.OmvDataSource({
   baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
   apiFormat: harp.APIFormat.XYZOMV,
   styleSetName: "tilezen",
   authenticationCode: "YOUR-XYZ-TOKEN",
});
map.addDataSource(omvDataSource);

Node modules

Generate a simple app using the package generator:

mkdir 3dmap-example
cd 3dmap-example
npx -p yo -p @here/generator-harp.gl yo @here/harp.gl

About This Repository

This repository is a monorepo containing the core components of harp.gl, organized in a yarn workspace.

All components can be used stand-alone and are in the @here subdirectory.

Installation

In Node.js

All harp.gl modules are installable via yarn (or npm):

yarn add @here/harp-mapview
npm install @here/harp-mapview

In Browser

Since harp.gl consists of a set of modules, there are no ready-made bundles available. Take a look at the examples on information on how to use tools like webpack to create a bundle for the browser.

Development

Prerequisites

  • Node.js - Please see nodejs.org for installation instructions
  • Yarn - Please see yarnpkg.com for installation instructions.

Download dependencies

Run:

yarn install

to download and install all required packages and set up the yarn workspace.

Launch development server for harp.gl examples

Run:

yarn start

To launch webpack-dev-server. Open http://localhost:8080/ in your favorite browser.

Launch development server for unit tests

Run:

yarn start-tests

Open http://localhost:8080/ in your favorite browser to run the tests.

Run unit tests in Node.js environment

Run:

yarn test

Run unit & integration tests in Browser environment

Run:

yarn run start-tests
>: Project is running at http://localhost:8080/

Note the URL and invoke tests using mocha-webdriver-runner. Example:

npx mocha-webdriver-runner http://localhost:8081/ --chrome
npx mocha-webdriver-runner http://localhost:8081/ --headless-firefox

Generate documentation

Run:

yarn run typedoc

It will output all documentation under /dist/doc.

License

Copyright (C) 2018-2019 HERE Europe B.V.

See the LICENSE file in the root of this project for license details about using harp.gl.

In addition, please note that the fonts are under a different set of licenses.

For other use cases not listed in the license terms, please contact us.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.