参照文档所给示例使用下列代码进行提取等值线操作,报错信息为“设置的提取范围出错”。
代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_surfaceAnalystService"></title>
</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%"></div>
<script type="text/javascript" src="./dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var map, region, resultLayer, surfaceAnalystService, surfaceAnalystParameters,
baseUrl = "http://localhost:8090/iserver/services/map-climate-china/rest/maps/",
serviceUrl = "http://localhost:8090/iserver/services/spatialAnalysis-climate-china/restjsr/spatialanalyst";
map = L.map('map', {
crs: L.CRS.NonEarthCRS({
bounds: L.bounds([-2640403.63, 1873792.1], [3247669.39, 5921501.4]),
origin: L.point(-2640403.63, 5921501.4)
}),
center: [3580330, 531762],
maxZoom: 18,
zoom: 2
});
L.supermap.tiledMapLayer(baseUrl).addTo(map);
surfaceAnalystProcess();
function surfaceAnalystProcess() {
region = L.polygon([
[4010338, 0],
[4010338, 1063524],
[3150322, 1063524],
[3150322, 0]
]);//截选范围可以不要这个参数
surfaceAnalystParameters = new SuperMap.DatasetSurfaceAnalystParameters({
extractParameter: new SuperMap.SurfaceAnalystParametersSetting({
datumValue: 0,
interval: 2,
resampleTolerance: 0,
smoothMethod: SuperMap.SmoothMethod.BSPLINE,//等线
smoothness: 3,
clipRegion: null
}),
dataset: "China_ProCenCity_pt@ChinaClimate",//数据集
resolution: 0.00001,
zValueFieldName: "Temp_User"//字段
});
surfaceAnalystService = L.supermap.spatialAnalystService(serviceUrl);
surfaceAnalystService.surfaceAnalysis(surfaceAnalystParameters, function (serviceResult) {
var result = serviceResult.result;
if (result && result.recordset && result.recordset.features) {
resultLayer = L.geoJSON(result.recordset.features, {weight: 3}).addTo(map);
} else {
alert(serviceResult.error.errorMsg);
}
});
}
</script>
</body>
</html>
报错截图如下: