npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ly_cesium

v0.7.1

Published

最高支持Cesium1.92版

Downloads

185

Readme

ly_cesium

说明

最高支持Cesium1.92版

0.6.5后将支持Cesium1.121、不支持Cesium1.92需根据实际情况判断使用

邮箱

[email protected]

安装

需在index.html中引入地形与cesium js文件
<link rel="stylesheet" href="xxxxx/cesium_xxx/Cesium/Widgets/widgets.css">
<script src="xxx/cesium_xxx/Cesium/Cesium.js"></script>
<script src="http://api.tianditu.gov.cn/cdn/plugins/cesium/cesiumTdt.js" ></script>

npm install ly_cesium

快速引入

import { Source } from 'ly_cesium'  
const viewer = Source.Map.init(containerId, config, cesiumToken)
添加图层
Source.Map.addLayer(viewer, Source.Layer.tianLayer('天地图Token'))

可用图层

天地图卫星图
Source.Layer.tianLayer('天地图Token')
天地图标注
Source.Layer.tianTagging('天地图Token')
天地图国界
Source.Layer.tianCountryBorder('天地图Token')
天地图地形
Source.Layer.tianTerrainLayer(viewer, '天地图Token')
天地图影像服务
Source.Layer.tianAddImage(viewer, '天地图Token')
百度地图
Source.Layer.baiduLayer()
百度卫星地图
Source.Layer.baiduLayerImage()
高德影像
Source.Layer.gaodeImageLayer()
高德街道标注
Source.Layer.gaodeImageTagLayer()
高德街道图层
Source.Layer.gaodeStreeLayer()

点标绘(entity)

const _draw = new Draw.LyDrawPoint(viewer)
_draw.activate()

image

线段标绘(Primitive)

const drawLine = new LyDrawLine(viewer)
drawLine.activate()
drawLine.finish = (positions)=>{
}

面标绘(Primitive)

const draw = new LyDrawPolygon(viewer)
draw.activate()
draw.finish = (positions) => {
   
}

image

面标绘(Entity)可进行贴地绘制

const _draw = new Entity.DrawPolygon(viewer)
_draw.activate()
_draw.finish = ()=>{
  // 结束
}

image

线段添加(Primitive)

const lineManager = new LyLineManager(viewer)
lineManager.addByPosition(positions)
可添加彩色线段

image image

测距离

const _distance = new Distance(viewer)
_distance.activate()
_distance.finish = (distance, positions) => {
  // distance距离 千米
  // positions 笛卡尔坐标数组
}

image

测面积

const _measure = new Area(viewer)
_measure.activate()
_measure.finish = (area, positions, coordinates) => {
  // area 面积 单位km²
  // positions 笛卡尔坐标数组
  // coordinates 经纬度坐标数组
}

image

测高度

const _measure = new Measure.Height(viewer)
_measure.activate()

image

聚合类

const _cluster = new LyCluster(viewer)
const coordinates = [
  { latitude: 30.2084, longitude: 120.21201, height: 0 },
  { latitude: 31.2084, longitude: 120.21201, height: 0 },
  { latitude: 30.2083, longitude: 120.21201, height: 0 },
  { latitude: 30.2082, lnlongitudeg: 120.21201, height: 0 }
]
coordinates.forEach(e => {
  const entity = Entity.LyCluster.CreatePoint(null, Source.Map.coordinateHeightToCartesian(viewer, e))
  _cluster.addEntity(entity)
})

image

添加天气

雨天
const weather = new Weather.LyRain(viewer, { tiltAngle: 0.6, size: 0.02, speed: 150 })
weather.add()
雪、雾等类似

image image

动态纹理
image
image
image

模型管理

const _manager = new Model.LyGltfManager(viewer)
_manager.addControl(() => {

})

image

截图功能

const _screenshot = new Source.Screenshot(viewer)
_screenshot.get({
  success: (e) => {
    // e blob
  },
  fail: () => {

  }
})

自动下载图片
_screenshot.download = true

裁剪功能

const _clippinng = new Clipping.LyClippingPlane(viewer)
_clippinng.activate()

image image

地形多面裁剪 由于Cesium官方对于地形的裁剪只支持一个,通过修改源码实现多面裁剪,最高支持Cesium1.92
版本0.4.19及以上支持该功能 image

_draw = new Clipping.Index(viewer)
_draw.activate()
// 是否开启土壤填充
_draw.fill = false 

分屏显示

image

其他动态纹理,以及其他标绘具体使用说明情况请看语雀