react-mapbox-gl - npm
文章推薦指數: 80 %
A React binding of mapbox-gl-js. Latest version: 5.1.1, last published: 2 years ago. Start using react-mapbox-gl in your project by running ... react-mapbox-gl5.1.1 • Public • Published2yearsagoReadmeExploreBETA5Dependencies93Dependents142Versions React-mapbox-gl|Documentation|Demos Reactwrapperformapbox-gl-js. Components Proxycomponents(proxybetweenReactandMapboxAPI) ReactMapboxGL Layer&Feature propertysymboldisplaysamapboxsymbol. propertylinedisplaysalineString. propertyfilldisplaysapolygon. propertycircledisplaysamapboxcircle. propertyrasterdisplaysamapboxrastertiles. propertyfill-extrusiondisplaysalayerwithextrudedbuildings. propertybackgrounddisplaysamapboxbackgroundlayer. propertyheatmapdisplaysamapboxheatmaplayer. Source GeoJSONLayer DOMcomponents(normalReactcomponents) ZoomControl ScaleControl RotationControl Marker(Projectedcomponent) Popup(Projectedcomponent) Cluster GettingStarted npminstallreact-mapbox-glmapbox-gl--save Example: Addingthecssinyourindex.html:
... // ES6import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl';import 'mapbox-gl/dist/mapbox-gl.css'; // ES5var ReactMapboxGl = require('react-mapbox-gl');var Layer = ReactMapboxGl.Layer;var Feature = ReactMapboxGl.Feature;require('mapbox-gl/dist/mapbox-gl.css'); const Map = ReactMapboxGl({ accessToken: 'pk.eyJ1IjoiZmFicmljOCIsImEiOiJjaWc5aTV1ZzUwMDJwdzJrb2w0dXRmc2d0In0.p6GGlfyV-WksaDV_KdN27A'}); // in render(); Whyarezoom,bearingandpitchArrays? Ifthosepropertieschangedatthemapbox-gl-jslevelandyoudon'tupdatethevaluekeptinyourstate,itwillbeunsyncedwiththecurrentviewport.Atsomepointyoumightwanttoupdatetheviewportvalue(zoom,pitchorbearing)withtheonesinyourstatebutusingvalueequalityisnotenough.Takingzoomasexample,youwillstillhavetheunsyncedzoomvaluethereforewecan'ttellifyouwanttoupdatethepropornot.Inordertoexplicitlyupdatethecurrentviewportvaluesyoucaninsteadbreakthereferencesofthosepropsandreliablyupdatethecurrentviewportwiththeoneyouhaveinyourstatetobesyncedagain. Currentversiondocumentation Version3.0documentation Version2.0documentation Contributions Pleasetrytoreproduceyourproblemwiththeboilerplatebeforepostinganissue. mapbox-gl-drawcompatibility Tryreact-mapbox-gl-draw LookingforanAngularalternative? Tryngx-mapbox-gl Keywordsmapboxreactmapwebglmapbox-glreact-componentInstallnpmireact-mapbox-glRepositoryGitgithub.com/alex3165/react-mapbox-glHomepagegithub.com/alex3165/react-mapbox-gl#readmeDownloadsWeeklyDownloads43,896Version5.1.1LicenseMITUnpackedSize496kBTotalFiles174Lastpublish2yearsagoCollaboratorsTryonRunKitReportmalware延伸文章資訊
- 1Use Mapbox GL JS in a React app | Help
You have created a React app that uses Mapbox GL JS to render a map, display the center coordinat...
- 2react-map-gl examples - CodeSandbox
Learn how to use react-map-gl by viewing and forking react-map-gl example apps on CodeSandbox.
- 3A React binding of mapbox-gl-js - GitHub
ReactMapboxGL · Layer & Feature. property symbol displays a mapbox symbol. property line displays...
- 4Mapbox GL | Help
- 5visgl/react-map-gl: React friendly API wrapper around ... - GitHub
react-map-gl is a suite of React components designed to provide a React API for Mapbox GL JS-comp...