arcgis api for javascript从地图如何读取要素

arcgis api for javascript如何读取要素,通过ajax请求得到的。

比如:

https://gis118.arcgisonline.cn/arcgis/sharing/rest/content/items/f08f5c59cd89420abf7e585eaa260ddd/data


可以得到FeatureLayer要素服务,这里只需要配置好f08f5c59cd89420abf7e585eaa260ddd,即itemid,就可以得到operationalLayers,得到的是一个数组,然后根据类型匹配。

{"operationalLayers":[{"id":"15d1ac59ea4-layer-0","opacity":1,"title":"Aggregation of bigDataFileShares xin3 csv by hexagon bins - Aggregation of bigDataFileShares xin3 csv by hexagon bins","url":"https://gis118.arcgisonline.cn/arcgis/rest/services/Hosted/Aggregation_of_bigDataFileShares_xin3_csv_by_hexagon_bins/FeatureServer/0","visibility":true,"layerType":"ArcGISFeatureLayer","itemId":"62be1d8c97c4461383ea4ec738e96c5c","popupInfo":{"fieldInfos":[{"fieldName":"COUNT","label":"COUNT","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"COUNT_MmeUeS1apId","label":"COUNT_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SUM_MmeUeS1apId","label":"SUM_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MIN_MmeUeS1apId","label":"MIN_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MAX_MmeUeS1apId","label":"MAX_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MEAN_MmeUeS1apId","label":"MEAN_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"RANGE_MmeUeS1apId","label":"RANGE_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SD_MmeUeS1apId","label":"SD_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"VAR_MmeUeS1apId","label":"VAR_MmeUeS1apId","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"COUNT_Lat","label":"COUNT_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SUM_Lat","label":"SUM_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MIN_Lat","label":"MIN_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MAX_Lat","label":"MAX_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MEAN_Lat","label":"MEAN_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"RANGE_Lat","label":"RANGE_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SD_Lat","label":"SD_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"VAR_Lat","label":"VAR_Lat","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"COUNT_Lon","label":"COUNT_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SUM_Lon","label":"SUM_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MIN_Lon","label":"MIN_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MAX_Lon","label":"MAX_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"MEAN_Lon","label":"MEAN_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"RANGE_Lon","label":"RANGE_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"SD_Lon","label":"SD_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"VAR_Lon","label":"VAR_Lon","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"COUNT_Time","label":"COUNT_Time","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"ANY_Time","label":"ANY_Time","visible":true},{"fieldName":"COUNT_UUID","label":"COUNT_UUID","visible":true,"format":{"digitSeparator":true,"places":2}},{"fieldName":"ANY_UUID","label":"ANY_UUID","visible":true},{"fieldName":"globalid","label":"globalid","visible":true},{"fieldName":"OBJECTID","label":"OBJECTID","visible":true,"format":{"digitSeparator":true,"places":2}}],"showAttachments":false,"title":"Aggregation of bigDataFileShares xin3 csv by hexagon bins - Aggregation of bigDataFileShares xin3 csv by hexagon bins","popupElements":[{"type":"fields"}]}},{"id":"15d1ac663d0-layer-1","opacity":1,"title":"MyMapService","url":"https://gis118.arcgisonline.cn/arcgis/rest/services/MyMapService/MapServer","visibility":true,"layerType":"ArcGISMapServiceLayer","itemId":"5d1ec72dc49c436cb4547df7e50785a8"}],"baseMap":{"baseMapLayers":[],"id":"15cf1a61dab-basemap-0","title":"Topographic","elevationLayers":[{"id":"globalElevation","listMode":"hide","title":"Terrain3D","url":"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer","visibility":true,"layerType":"ArcGISTiledElevationServiceLayer"}]},"version":"1.4","authoringApp":"WebSceneViewer","authoringAppVersion":"10.5.0","presentation":{"slides":[]},"initialState":{"environment":{"lighting":{"datetime":1426395530000,"displayUTCOffset":7}},"viewpoint":{"scale":7525651.004665631,"rotation":358.5726526269468,"targetGeometry":{"x":1.172152354722387E7,"y":2931754.9651887054,"z":1401.3526187865064,"spatialReference":{"wkid":102100,"latestWkid":3857}},"camera":{"position":{"x":1.1720946560564639E7,"y":2908616.633524697,"z":3039970.5823473614,"spatialReference":{"wkid":102100,"latestWkid":3857}},"heading":1.4273473730531656,"tilt":0.3944495355698415}}},"spatialReference":{"wkid":102100,"latestWkid":3857},"viewingMode":"global"}


核心代码:

 var itemURL = portalitem + webscene + "/data";

    esriRequest(itemURL, {
        responseType: "json"
    }).then(function (response) {
        // The requested data
        var Layers = response.data.operationalLayers;
        //this.config.operationalLayers = response.data.operationalLayers;
        _self._getLayersData(Layers);
    });
},

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Soyoger

听说打赏的都进了福布斯排行榜。

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值