Geojson
创建
typescript
const geojson = await loadGeoJson({ url: '../assets/Polygon.geojson' })类型
typescript
type LoadGeoJson = {
(parm: GeoJsonParm, id?: string): Promise<GeoJson>;
};
type GeoJsonOptions = {
url: string;
show?: boolean;
point?: {
url: string | HTMLCanvasElement;
scale?: number;
far?: number;
textProperty?: string;
font?: string;
color?: MapColor;
outlineColor?: MapColor;
backgroundColor?: MapColor;
showBackground?: boolean;
style?: 'fill' | 'outline' | 'fill_and_outline';
outlineWidth?: number;
verticalOrigin?: 'center' | 'bottom' | 'top';
horizontalOrigin?: 'center' | 'left' | 'right';
offset?: { x: number; y: number };
position?: boolean;
};
describe?: (property: unknown) => void;
markerSize?: number;
markerSymbol?: string;
markerColor?: MapColor;
stroke?: MapColor;
strokeWidth?: number;
fill?: MapColor;
clampToGround?: boolean;
isToken?: boolean; //是否需要发送验证信息 false
questType?: 'headers' | 'params'; //发送方式 'headers'
tokenKey?: string; // 信息key
token?: string; //验证信息
};判定
isGeoJson()
typescript
function isGeoJson(tar: object): tar is GeoJson属性
readonly id: string 唯一标识
readonly url: string url地址
readonly point: {url: string | HTMLCanvasElement}
show: boolean 是否显示
方法
focus 聚焦
typescript
focus():voidexportGeoJson 导出geojson
typescript
exportGeoJson(name?: string): Promise<void>destroy 销毁
typescript
destroy(): boolean