使用产品:iserver 10操作系统:win10 x64
数据类型:文件型
问题详细描述:要素资源(feature)里的坐标字段名有空格如何引用,字段名是Point2D X和Point2D Y,我的引用是feature.properties.Point2D X,显示undefined
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iServer REST</title>
<script src="dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript" src="js/web/include-web.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);
query();
}
</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">
var resultLayer;
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: ["EmergDS:Hospital_1"]
});
L.supermap
.featureService(url2)
.getFeaturesByIDs(idsParam, function (serviceResult) {
resultLayer = L.geoJSON(serviceResult.result.features,{
onEachFeature: function (feature, layer) {
layer.bindPopup("医院名称:"+feature.properties.NAME
+"<br>" +"X坐标:"+feature.properties.Point
);
}
}).addTo(map);
});
}
</script>
</body>
</html>