首页 / 浏览问题 / 云GIS / 问题详情
id查询,点击医院的图标id查询显示医院名称
7EXP 2020年07月06日

使用产品:iserver 10 操作系统:win10 x64
数据类型:  文件型
问题详细描述:id查询,点击医院的图标id查询显示医院名称,我是仿着supermap里的for leaflet里的ID查询写的,但是因为看不太懂,可能有些改的不对,现在也不可以点击,也不可以查询显示医院名称,data下面是datasets再下面有Hospital_1的数据集,请问datasetNames: ["datasets:Hospital_1"]这样填是对的吗?
问题重现步骤:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>iServer REST</title>
        <script src="dist/leaflet/include-leaflet.js"></script>
    </head>
    <script>
        var map,url="http://localhost:8090/iserver/services/map-yingjiguanli/rest/maps/City_1%40EmergDS"
        function onPageLoad(){
            map = L.map('map', {
               crs: L.CRS.EPSG4326,
               center: [30.61, 103.7],
               minZoom: 12,
               maxZoom: 18,
               zoom: 15
               });
            L.supermap.tiledMapLayer(url).addTo(map);
        }
    </script>
    <body onload=onPageLoad()>
         <!-- 地图 -->
        <!--div style="background: #f8f8f8;width: 100%;height: 100%;position:sticky;top: 0px;min-height: 664px;" id="map"-->
		<div style="background: #f8f8f8;width: 81%;height: 100%;position:sticky;top: 0px;min-height: 664px;" id="map">
           
        </div>
          <!-- 地图 -->
       <script type="text/javascript">
           query();
           var url2="http://localhost:8090/iserver/services/data-yingjiguanli/rest/data";
           function query(){
               var idsParam = new SuperMap.GetFeaturesByIDsParameters({
               IDs: [1,2,3,4,5,6],
               datasetNames: ["datasets:Hospital_1"]
               }); 
               L.supermap
                  .featureService(url2)
                  .getFeaturesByIDs(idsParam, function (serviceResult) {
                             resultLayer = L.geoJSON
                             (erviceResult.result.features,
                              {//获取返回的features数据
                                onEachFeature: function 
                                (feature, layer) {
                                  layer.bindPopup("ID: " + feature.properties.SMID +
                                   "<br>" +  ":" + feature.properties.NAME
                                   );
                                }
                  }).addTo(map);
            });
    }
       </script>
    </body>

</html>

1个回答

您好 datasetNames: ["World:Countries"] 代表数据源名称:数据集名称,请您确认下datasets是否是所对应的数据源名称?
3,352EXP 2020年07月07日
你好,已经将数据源改为了EmergDS,可是好像还是不可以
...