首页 / 浏览问题 / 云GIS / 问题详情
地图在tomcat上加载不出
24EXP 2019年01月14日

在本地文件包中直接打开html文件,地图能够加载,但是将项目部署到eclipse中,启动tomcat,在localhost中无法加载地图,打开tomcat默认浏览器报错,显示都是那个JS出错请问怎么解决

1个回答

您好,您这个页面主要是实现的什么功能?能把代码提供一下吗?
5,668EXP 2019年01月14日
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>数据集ID查询</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/include-leaflet.js"></script>
<script type="text/javascript">
    var host = window.isLocal ? window.server : "http://localhost:8090";
    var map, resultLayer,
        baseUrl = host + "/iserver/services/map-tm20190112/rest/maps/vec@天地图",
        
        url = host + "/iserver/services/data-tm20190112/rest/data";
    map = L.map('map', {
        preferCanvas: true,
        crs: L.CRS.EPSG4326,
        center: [30.35, 119.4],
        maxZoom: 18,
        zoom: 11
    });
    L.supermap.tiledMapLayer(baseUrl).addTo(map);
    querytree();
     queryxiaoban();
     querywaterarea();
    function querytree() {
        var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
            queryParameter: {
                
                name: "林场古树名木1@tm20",
                attributeFilter: "SMID<277",
                
                    
            },
            datasetNames: ["tm20:林场古树名木1"],
            toIndex:-1,
            returnContent: true,
        });
        L.supermap
            .featureService(url)
            .getFeaturesBySQL(sqlParam, function (serviceResult) {
                resultLayer = L.geoJSON(serviceResult.result.features, {
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup("古树名木ID: " + feature.properties.SMID+
                        "<br>" + "SMX: " + feature.properties.SMX+
                        "<br>" + "树名: " + feature.properties.中市+
                        "<br>" + "乡: " + feature.properties.乡
                        );
                    }
                }).addTo(map);
            });
    }
    
    function queryxiaoban() {
        var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
            queryParameter: {
                
                name: "小班边界1@tm20",
                attributeFilter: "SMID<350",
                
                    
            },
            datasetNames: ["tm20:小班边界1"],
            toIndex:-1,
            returnContent: true,
        });
        L.supermap
            .featureService(url)
            .getFeaturesBySQL(sqlParam, function (serviceResult) {
                resultLayer = L.geoJSON(serviceResult.result.features, {
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup("小班ID: " + feature.properties.SMID+
                        "<br>" + "小班面积: " + feature.properties.面积+
                          "<br>" + "土壤名: " + feature.properties.土壤名1+
                          "<br>" + "乡镇名: " + feature.properties.乡镇名+
                          "<br>" + "村名: " + feature.properties.村名名+
                          "<br>" + "灾害等: " + feature.properties.灾害等+
                           "<br>" + "林木使用权: " + feature.properties.林木使
                        );
                    }
                }).addTo(map);
            });
    }
    function querywaterarea() {
        var sqlParam = new SuperMap.GetFeaturesBySQLParameters({
            queryParameter: {
                
                name: "林场水域1@tm20",
                attributeFilter: "SMID<277",
                
                    
            },
            datasetNames: ["tm20:林场水域1"],
            toIndex:-1,
            returnContent: true,
        });
        L.supermap
            .featureService(url)
            .getFeaturesBySQL(sqlParam, function (serviceResult) {
                resultLayer = L.geoJSON(serviceResult.result.features, {
                    onEachFeature: function (feature, layer) {
                        layer.bindPopup("水域ID: " + feature.properties.SMID+
                        "<br>" + "SMX: " + feature.properties.SHAPE_LENG+
                        "<br>" + "树名: " + feature.properties.SHAPE_AREA+
                        "<br>" + "OBJECTID: " + feature.properties.OBJECTID
                        );
                    }
                }).addTo(map);
            });
    }
</script>
</body>
</html>

你好 是做ID查询的
...