首页 / 浏览问题 / WebGIS / 问题详情
在使用iclient for leaflet中的FeatureService
6EXP 2020年07月08日
<script type="text/javascript">
		var resultLayer;
		var mapurl='http://localhost:8090/iserver/services/map-China100-1/rest/maps/China'
		var dataURL='http://localhost:8090/iserver/services/data-China100-1-3/rest/data';
		var map=L.map('map', {
        	preferCanvas: true,
        	center: [39, 100],
        	maxZoom: 18,
        	zoom: 5
    	});
    	L.supermap.tiledMapLayer(mapurl).addTo(map);


    	query();
    	function query(){

        	var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
            	queryParameter: {
                	name: "China_Province_pg@China",
                	attributeFilter: "SMID < 34"
            	},
            	datasetNames: ["China:China_P"]
        	});
        	L.supermap.featureService(dataURL).getFeaturesBySQL(sqlParam, function (serviceResult) {
        		console.log(serviceResult.result.features);
        	});
    	}	

    </script>

代码如图,但运行时出现请求头文件错误

1个回答

你好400的话是语句错误,您可以修改一下查询语句,数据集为“null”的语句不用写,可参考示例代码https://iclient.supermap.io/examples/leaflet/editor.html#02_getFeatureBySQL

2,842EXP 2020年07月08日
...