Skip to content

Commit

Permalink
fix: update readme #16
Browse files Browse the repository at this point in the history
  • Loading branch information
hongfaqiu committed Jul 4, 2023
1 parent 1af20ad commit c52dfca
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ TIFFImageryProvider.fromUrl(YOUR_TIFF_URL, {
projFunc: (code) => {
if (code === 32760) {
proj4.defs("EPSG:32760", "+proj=utm +zone=60 +south +datum=WGS84 +units=m +no_defs +type=crs");
return proj4("EPSG:32760", "EPSG:4326").forward
return {
project: proj4("EPSG:32760", "EPSG:4326").forward,
unproject: proj4("EPSG:4326", "EPSG:4326").forward
}
}
}
});
Expand Down Expand Up @@ -127,8 +130,12 @@ interface TIFFImageryProviderOptions {
enablePickFeatures?: boolean;
hasAlphaChannel?: boolean;
renderOptions?: TIFFImageryProviderRenderOptions;
/** projection function, convert [lon, lat] position to EPSG:4326 */
projFunc?: (code: number) => (((pos: number[]) => number[]) | void);
projFunc?: (code: number) => {
/** projection function, convert [lon, lat] position to EPSG:4326 */
project: ((pos: number[]) => number[]);
/** unprojection function */
unproject: ((pos: number[]) => number[]);
} | undefined;
/** cache survival time, defaults to 60 * 1000 ms */
cache?: number;
/** geotiff resample method, defaults to nearest */
Expand Down
13 changes: 10 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ TIFFImageryProvider.fromUrl(YOUR_TIFF_URL, {
projFunc: (code) => {
if (code === 32760) {
proj4.defs("EPSG:32760", "+proj=utm +zone=60 +south +datum=WGS84 +units=m +no_defs +type=crs");
return proj4("EPSG:32760", "EPSG:4326").forward
return {
project: proj4("EPSG:32760", "EPSG:4326").forward,
unproject: proj4("EPSG:4326", "EPSG:4326").forward
}
}
}
});
Expand Down Expand Up @@ -126,8 +129,12 @@ interface TIFFImageryProviderOptions {
enablePickFeatures?: boolean;
hasAlphaChannel?: boolean;
renderOptions?: TIFFImageryProviderRenderOptions;
/** 投影函数,将[经度,纬度]位置转换为EPSG:4326 */
projFunc?: (code: number) => (((pos: number[]) => number[]) | void);
projFunc?: (code: number) => {
/** 投影函数,将 [lon, lat] 位置转换为 EPSG:4326 */
project: ((pos: number[]) => number[]);
/** 逆投影函数 */
unproject: ((pos: number[]) => number[]);
} | undefined;
/** 缓存生存时间,默认为60 * 3000毫秒 */
cache?: number;
/** geotiff 重采样方法, 默认为 nearest */
Expand Down
20 changes: 16 additions & 4 deletions packages/TIFFImageryProvider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Load GeoTIFF/COG(Cloud optimized GeoTIFF) on Cesium

[中文readme](./README_CN.md)

[![CodeSandbox](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/p/github/hongfaqiu/cog-example/main)

## Features

- Three band rendering.
Expand All @@ -21,6 +23,10 @@ Load GeoTIFF/COG(Cloud optimized GeoTIFF) on Cesium
```bash
#npm
npm install --save tiff-imagery-provider

#yarn
yarn add tiff-imagery-provider

#pnpm
pnpm add tiff-imagery-provider
```
Expand Down Expand Up @@ -60,7 +66,10 @@ TIFFImageryProvider.fromUrl(YOUR_TIFF_URL, {
projFunc: (code) => {
if (code === 32760) {
proj4.defs("EPSG:32760", "+proj=utm +zone=60 +south +datum=WGS84 +units=m +no_defs +type=crs");
return proj4("EPSG:32760", "EPSG:4326").forward
return {
project: proj4("EPSG:32760", "EPSG:4326").forward,
unproject: proj4("EPSG:4326", "EPSG:4326").forward
}
}
}
});
Expand Down Expand Up @@ -121,8 +130,12 @@ interface TIFFImageryProviderOptions {
enablePickFeatures?: boolean;
hasAlphaChannel?: boolean;
renderOptions?: TIFFImageryProviderRenderOptions;
/** projection function, convert [lon, lat] position to EPSG:4326 */
projFunc?: (code: number) => (((pos: number[]) => number[]) | void);
projFunc?: (code: number) => {
/** projection function, convert [lon, lat] position to EPSG:4326 */
project: ((pos: number[]) => number[]);
/** unprojection function */
unproject: ((pos: number[]) => number[]);
} | undefined;
/** cache survival time, defaults to 60 * 1000 ms */
cache?: number;
/** geotiff resample method, defaults to nearest */
Expand Down Expand Up @@ -252,7 +265,6 @@ pnpm start
- [x] Use Web Workers to generate tile image
- [x] GPU speed up calculation
- [ ] More efficient tile request method
- [ ] Web Workers Offscreen WebGL rendering

## Credits

Expand Down
2 changes: 1 addition & 1 deletion packages/TIFFImageryProvider/src/TIFFImageryProvider.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Event, GeographicTilingScheme, Credit, Rectangle, ImageryLayerFeatureInfo, Math as CMath, DeveloperError, defined, ImageryProvider, Cartesian2, WebMercatorTilingScheme, Cartographic } from "cesium";
import { Event, GeographicTilingScheme, Credit, Rectangle, ImageryLayerFeatureInfo, Math as CMath, DeveloperError, defined, Cartesian2 } from "cesium";
import GeoTIFF, { Pool, fromUrl, fromBlob, GeoTIFFImage } from 'geotiff';

import { addColorScale, plot } from './plotty'
Expand Down

1 comment on commit c52dfca

@vercel
Copy link

@vercel vercel bot commented on c52dfca Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.