Git Product home page Git Product logo

globe-demo's Introduction

预览

纯js模拟webgl三维地球绘制过程,具体功能说明如下:

  • 红色格网表示当前级别的瓦片范围,黄色格网表示webgl渲染的三角形带
  • 三维球每放大一级会造成顶点数量成指数增长,为避免影响性能,只模拟了2-6级
  • 按键盘的上、下、左、右可以旋转三维球,按+、-可以缩放三维球,没有做鼠标交互
  • 这里面涉及到的缩放级别和中心角度都是自定义的,没有归算到标准的地图级别和经纬度
  • 默认采用的epsg4490的瓦片进行模拟,如需要使用epsg3857的瓦片模拟,可以在开发模式修改投影参数

开发

yarn
yarn start

开始

let options = {
  container: 'globe',  // div容器
  center: [0,0],       // 中心角度 [水平旋转角,垂直旋转角]
  zoom: 2,             // 模拟的缩放级别,取值2-6
  layers: ['tile','grid'],  // 显示的图层,'tile'为瓦片格网,'grid'为webgl三角形格网
  projection: 'epsg4490'    // 瓦片投影
}
let globe = new Globe(options)

API

setCenter(center)

setZoom(zoom)

setLayers(['tile'])

getCenter()

getZoom()

globe-demo's People

Contributors

wanyanyan avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

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.