Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hongfaqiu/cesium-graticule
Lat/Lon Graticule for Cesium map/ 为cesium添加一个经纬网
https://github.com/hongfaqiu/cesium-graticule
cesium graticule
Last synced: 14 days ago
JSON representation
Lat/Lon Graticule for Cesium map/ 为cesium添加一个经纬网
- Host: GitHub
- URL: https://github.com/hongfaqiu/cesium-graticule
- Owner: hongfaqiu
- License: apache-2.0
- Created: 2022-04-08T08:46:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-31T06:37:53.000Z (almost 2 years ago)
- Last Synced: 2024-12-29T01:06:51.060Z (28 days ago)
- Topics: cesium, graticule
- Language: TypeScript
- Homepage: https://cesium-graticule.vercel.app
- Size: 162 KB
- Stars: 12
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cesium-graticule
Lat/Lon Graticule for Cesium map
![](https://img.shields.io/bundlephobia/minzip/cesium-graticule) ![](https://img.shields.io/npm/v/cesium-graticule) ![](https://img.shields.io/npm/types/cesium-graticule) ![](https://img.shields.io/npm/l/cesium-graticule)
## Install
```bash
npm install --save cesium-graticulepnpm add cesium-graticule
```## Usage
a ``cesiumGraticule`` global object is exported in borwser
```ts
import * as Cesium from "cesium";
import Graticule from 'cesium-graticule';const cesiumViewer = new Cesium.Viewer("cesiumContainer");
const GraticuleObj = Graticule(cesiumViewer);
```## API
```ts
class Graticules {
/**
* Create a Graticules Object
* @param {Viewer} viewer cesium viewer
* @param {GraticulesOptions} [options] - Object with the following properties:
* @param {Color} [options.color = Color.WHITE.withAlpha(.5)] - The line color. Defaults to Color.WHITE.withAlpha(.5)
* @param {Color} [options.meridiansColor = Color.YELLOW] - The meridians line color, show only meridians option is true. Defaults to Color.YELLOW
* @param {number} [options.debounce = 500] - The render debounce value, defaults to 500ms
* @param {number} [options.gridCount = 15] - Lines in screen, defaults to 15
* @param {boolean} [options.meridians = true] - If show the colored meridians, defaults to true
* @param {LabelOptions} [options.labelOptions] - The label style
* @example
* const GraticulesObj = new Graticules(MapObj.viewer, {
* meridians: false
* });
*/
constructor(viewer: Viewer, options?: GraticulesOptions);
/**
* Get or set graticules visible
*/
get visible(): boolean;
set visible(val: boolean);
get isDestroyed(): boolean;
/**
* Show Lat/Lon Graticule
*/
show(): void;
/**
* Hide Lat/Lon Graticule
*/
hide(): void;
/**
* Destory class
*/
destory(): void;
}type GraticulesOptions = {
/**
* The line color. Defaults to Color.WHITE.withAlpha(.5)
*/
color?: Color;
/**
* The meridians line color, show only meridians option is true. Defaults to Color.YELLOW
*/
meridiansColor?: Color;
/**
* The render debounce value, defaults to 500ms
*/
debounce?: number;
/**
* Lines in screen, defaults to 15
*/
gridCount?: number;
/**
* If show the colored meridians, defaults to true
*/
meridians?: boolean;
/**
* Label style
*/
labelOptions?: LabelOptions;
};type LabelOptions = {
/**
* font css, defaults to `bold 1rem Arial`
*/
font?: string;
/**
* defaults to Color.WHITE
*/
fillColor?: Color;
/**
* defaults to Color.BLACK
*/
outlineColor?: Color;
/**
* defualts to 4
*/
outlineWidth?: number;
/**
* Describes how to draw a label, defaults to LabelStyle.FILL_AND_OUTLINE
*/
style?: LabelStyle;
};
```## Demo
[online Demo](https://cesium-graticule.vercel.app/)
Launch the app in the demo folder, and then visit http://localhost:8080/
```node
pnpm i
npm start
```| [![L6W1OK.md.png](https://s1.ax1x.com/2022/04/21/L6W1OK.md.png)](https://imgtu.com/i/L6W1OK) | [![L6WWpn.png](https://s1.ax1x.com/2022/04/21/L6WWpn.png)](https://imgtu.com/i/L6WWpn) |
| ------- | ------- |## Credit
https://github.com/leforthomas/cesium-addons
[Mapshot.app - Graticule Fork](https://mapshot.app/#editorvisible=true&autorun=true&drawerposition=67.05&code=FAegVGwARlDCB7ADgTwE4EsDmALALlACLYZ4CGANgIJoDOApgHaUB0GCANFAJKMDGLKACYADEICM0WABkMfJgwAmUAK6NF9NFDw56UKkjJ9dUWfMYMuANU212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