Leaflet空间分析提取等值线显示提取范围出错

0 投票

参照文档所给示例使用下列代码进行提取等值线操作,报错信息为“设置的提取范围出错”。

代码如下:

<!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>

报错截图如下:

7月 6 分类:  109次浏览 | 用户: PixelMap (1 分)

1个回答

0 投票
您好,“报错信息为‘设置的提取范围出错‘“和你的面的第一个点就可以判断,是你这个面的范围超过地图的范围了,你把你的面的范围缩小到地图范围内在做分析
7月 6 用户: johnJJ 才高八斗 (842 分)
但是代码里已将clipRegion属性修改为null,理论上应该不会使用我所设置的面进行分析,而是对全图进行分析;而且,即使我删除了前面对面的划定代码,或是将面缩小至地图范围内,仍显示“设置的提取范围出错”
把你的数据和代码发我邮箱(jiangwanjun@supermap.com)一下,我测试一下
...