From ae96a5440afe337e2097ea034855ad6c739dbc7f Mon Sep 17 00:00:00 2001 From: deyihu Date: Sun, 13 Oct 2024 10:34:14 +0800 Subject: [PATCH] update readme --- README.md | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c110d25..4a64e65 100644 --- a/README.md +++ b/README.md @@ -123,13 +123,6 @@ import { const maskId = 'china'; const tileActor = getTileActor(); -const polygon = { - "type": "Feature", - "geometry": { - "type": "Polygon", - "coordinates": [] - } -} tileActor.removeMask(maskId).then(data => { @@ -150,8 +143,8 @@ import * as maptalks from 'maptalks'; import { getTileActor } from 'maptalks.tileclip' -const tileActor = maptalks.getTileActor(); -const maskId = '1'; +const tileActor = getTileActor(); +const maskId = 'china'; const baseLayer = new maptalks.TileLayer('base', { debug: true, urlTemplate: '/arcgisonline/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', @@ -188,4 +181,18 @@ baseLayer.on('renderercreate', function(e) { }) }; }); + +const polygon = { + "type": "Feature", + "geometry": { + "type": "Polygon", + "coordinates": [] + } +} + +tileActor.injectMask(maskId, polygon).then(data => { + baseLayer.addTo(map); +}).catch(error => { + console.error(error); +}) ```