how can i add source and layer to my react-map-gl
文章推薦指數: 80 %
i'm trying to add source and layers on my map and it's not rendering ... import ReactMapGL, {Source, Layer} from 'react-map-gl' const data ...
Resultsfromthe2022DeveloperSurveyarehere.
Home
Public
Questions
Tags
Users
Companies
Collectives
ExploreCollectives
Teams
StackOverflowforTeams
–Startcollaboratingandsharingorganizationalknowledge.
CreateafreeTeam
WhyTeams?
Teams
CreatefreeTeam
Collectives™onStackOverflow
Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost.
Learnmore
Teams
Q&Aforwork
Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch.
Learnmore
howcaniaddsourceandlayertomyreact-map-gl
AskQuestion
Asked
1year,6monthsago
Modified
1year,6monthsago
Viewed
2ktimes
0
i'mtryingtoaddsourceandlayersonmymapandit'snotrenderingeventhoughthemapisbeingrendered.
Butwheneverichangethesourcetypetovectoritworked,butthetypeiwanttouseisgeojson(inordertousepolygonsandpolyline),butitdoesn'tseemtowork.
Idon'tknowwhati'mdoingwrong,i'vebeentryingtofixthisforhours,evenreadthedocuments,istilldon'tknowwhati'mdoingwrong.
hereisthecodebelow.
importReactMapGL,{Source,Layer}from'react-map-gl'
constdata={
type:"Feature",
geometry:{
type:"Polygon",
coordinates:[
[
-107.814303,
37.935657
],
[
-107.814424,
37.936094
],
[
-107.816288,
37.936826
],
[
-107.814644,
37.940931
],
[
-107.80993,
37.939892
],
[
-107.807686,
37.939376
],
[
-107.80932,
37.935416
],
[
-107.809507,
37.935014
],
[
-107.810191,
37.934835
],
[
-107.810765,
37.934708
],
[
-107.811377,
37.934732
],
[
-107.813902,
37.935372
],
[
-107.814303,
37.935657
]
]
}
}
延伸文章資訊
- 1Urbica React Mapbox GL JS - GitHub
React Component Library for Mapbox GL JS. Mapbox GL JS is a JavaScript library that renders inter...
- 2Layer - react-map-gl
This component allows apps to create a map layer using React. import * as React from 'react'; imp...
- 3react-map-gl-draw - npm
A lite version editing layer with react. Latest version: 1.0.3, last published: 2 months ago. Sta...
- 4how can i add source and layer to my react-map-gl
i'm trying to add source and layers on my map and it's not rendering ... import ReactMapGL, {Sour...
- 5MAP integration in React with react-map-gl and deck-gl