这是我第一次使用JavaScript的ArcGIS API。我遇到了一个相当简单的错误。我不能得到我在ArcGIS Online上托管的图层出现在地图上。这是我的代码:< / P > < DIV > < DIV > < SPAN >要求< / SPAN > < SPAN > ([< / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN >“esri / config”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN >“esri /地图”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN > " esri /层/ FeatureLayer”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >, "esri/views/MapView"
This script produces the following error in my browser:
[esri.Map] #add() The item being added is not a Layer or a Promise that resolves to a Layer.
My layer can be found here: https://services.arcgis.com/HRPe58bUyBqyyiCt/ArcGIS/rest/services/1_year_high_lake_level/FeatureServer/13
I can't figure out why it won't appear.
Thanks in advance.
这是我第一次使用JavaScript的ArcGIS API。我遇到了一个相当简单的错误。我不能得到我在ArcGIS Online上托管的图层出现在地图上。这是我的代码:< / P > < DIV > < DIV > < SPAN >要求< / SPAN > < SPAN > ([< / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN >“esri / config”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN >“esri /地图”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >,,< / SPAN > < SPAN > " esri /层/ FeatureLayer”< / SPAN > < SPAN >, < / SPAN > < / DIV > < DIV > < SPAN >, "esri/views/MapView"
This script produces the following error in my browser:
[esri.Map] #add() The item being added is not a Layer or a Promise that resolves to a Layer.
My layer can be found here: https://services.arcgis.com/HRPe58bUyBqyyiCt/ArcGIS/rest/services/1_year_high_lake_level/FeatureServer/13
I can't figure out why it won't appear.
Thanks in advance.
在你的require和function中,MapView和FeatureLayer顺序被交换了。当使用amd时,顺序很重要。