Layer - react-map-gl
文章推薦指數: 80 %
This component allows apps to create a map layer using React. import * as React from 'react'; import Map, {Layer} from 'react-map-gl'; const parkLayer ...
ChevronDownIntroductionIntroductionWhat'snewUpgradeGuideContributingtoreact-map-glChevronDownDeveloperGuideGetStartedAboutMapboxTokensStateManagementAddingCustomDataTipsandTricksChevronDownAPIReferencedefault(Map)AttributionControlFullscreenControlGeolocateControlLayerMapProviderMarkerNavigationControlPopupScaleControlSourceuseControluseMapTypesLayerThiscomponentallowsappstocreateamaplayerusingReact.import*asReactfrom'react';
importMap,{Layer}from'react-map-gl';
constparkLayer={
id:'landuse_park',
type:'fill',
source:'mapbox',
'source-layer':'landuse',
filter:['==','class','park'],
paint:{
'fill-color':'#4E3FC8'
}
};
functionApp(){
return;
}PropertiesThepropsprovidedtothiscomponentshouldbeconformingtotheMapboxlayerspecification.Whenpropschangeshallowly,thecomponentwillperformstylediffingtoupdatethelayer.Avoiddefiningconstantobjects/arraysinlinemayhelpperformance.IdentityPropertiesOncea
延伸文章資訊
- 1Dynamically changing the layer order is not possible #939
Hello, In my use case I have a list of layers whose order can be messed up with. I made this sand...
- 2react-map-gl - npm
React components for Mapbox GL JS-compatible libraries. Latest version: 7.0.16, last published: 6...
- 3Layer — Urbica React Map GL
Except for layers of the background type, each layer needs to refer to a source. Layers take the ...
- 4react-map-gl examples - CodeSandbox
Learn how to use react-map-gl by viewing and forking react-map-gl example apps on ... that provid...
- 5Urbica React Mapbox GL JS - GitHub
React Component Library for Mapbox GL JS. Mapbox GL JS is a JavaScript library that renders inter...