如果我在 Esri-React-Boot 上修改底图,则没有地图显示
No Map Shows If I Modify the Basemap on Esri-React-Boot
我很困惑,不知道自己做错了什么。我目前正试图从 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"
]
}
}
提前致谢。
https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap
这显示底图的可用性取决于是否使用 API 密钥。
我很困惑,不知道自己做错了什么。我目前正试图从 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"
]
}
}
提前致谢。
https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#basemap
这显示底图的可用性取决于是否使用 API 密钥。