我被卡住了,不知道我做错了什么。我目前正在尝试从Esri (https://github.com/Esri/esri-react-boot)修改这个库。
它使用OAuth,但您无需登录即可查看地图。但是,如果我想修改basemap配置以显示arcgis-topographic,就像教程在这里显示的那样(https://developers.arcgis.com/javascript/latest/display-a-map/),我得不到任何地图的渲染。
本教程使用了一个API键,但是在使用OAuth时,您应该不需要这样做。
下面是我唯一修改过的2个文件,其他的都和repo中的一样。
config.json
{
"appVersion": "2.0.0",
"apiUrl": "api",
"loginUrl": "api/auth/arcgis",
"logoutUrl": "api/logout",
"jsapiUrl": "https://js.arcgis.com/4.17/",
"jsapiV4": true,
"clientId": "<hidden>",
"sessionId": "esri-react-boot_session",
"mapConfig": {
"basemap": "arcgis-topographic",
"center": [-118.805, 34.027],
"zoom": 13
}
}package.json
{
"name": "react-jsapi-app",
"version": "0.1.0",
"private": true,
"homepage": "/",
"dependencies": {
"@esri/arcgis-rest-auth": "^3.0.0",
"@esri/arcgis-rest-portal": "^3.0.0",
"@esri/arcgis-rest-request": "^3.0.0",
"calcite-react": "^0.44.0",
"esri-loader": "^2.16.0",
"framer-motion": "^1.6.18",
"js-cookie": "^2.2.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-transition-group": "^4.3.0",
"redux": "^4.0.4",
"redux-saga": "^1.1.3",
"styled-components": "^4.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"devDependencies": {
"react-scripts": "^3.3.0"
},
"browserslist": {
"development": [
"last 2 chrome versions",
"last 2 firefox versions",
"last 2 edge versions"
],
"production": [
">1%",
"last 4 versions",
"Firefox ESR",
"not ie < 11"
]
}
}提前谢谢你。
发布于 2021-02-03 03:32:22
https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap
这显示了底图的可用性,这取决于是否使用API密钥。
https://stackoverflow.com/questions/65961349
复制相似问题