示例栅格查询函数,
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_getGridCellInfos"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%;background-color: white"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map, marker,
baseUrl = host + "/iserver/services/map-world/rest/maps/世界地图_Day",
url = host + "/iserver/services/data-world/rest/data";
map = L.map('map', {
preferCanvas: true,
crs: L.CRS.EPSG4326,
center: {lon: 0, lat: 0},
maxZoom: 18,
zoom: 2
});
L.supermap.tiledMapLayer(baseUrl, {noWrap: true}).addTo(map);
map.on("click", function (evt) {
var x = evt.latlng.lng;
var y = evt.latlng.lat;
var c=hanshu(x,y);
alert(c)
}
);
function hanshu(x,y){
var getGridCellInfosParam = new SuperMap.GetGridCellInfosParameters({
dataSourceName: "World",
datasetName: "WorldEarth",
X: x,
Y: y
});
L.supermap
.gridCellInfosService(url)
.getGridCellInfos(getGridCellInfosParam, function (serviceResult) {
var x=serviceResult.result.value
});
}
</script>
</body>
</html>
如何想通过输入xy返回像素值,上述程序无法做到,有什么办法吗