0

我正在尝试使用 Geoserver 作为学习过程将 Openlayers 与 ASP MVC3 集成,但遇到了这个奇怪的问题。当我加载视图时,地图画布会出现默认缩放控件的空白。只有当我按下放大按钮时,地图才会显示。我最初认为这与 ASP 的 Razor View 有关,所以我将其复制到单独的 HTML 文件中,但问题仍然存在。有什么建议么?

<html>
<head>
<script type="text/javascript" src="http://openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">

    function init() {
        var bounds = new OpenLayers.Bounds(
                    -124.848974, 45.543541,
                    -116.91558, 49.002494);
        var options = {
            maxExtent: bounds,
            maxResolution: 0.0309898203125,
            projection: "EPSG:4326",
            units: 'degrees'
        };
        var map = new OpenLayers.Map('map', options);
        var wms = new OpenLayers.Layer.WMS("Washington County Map", "http://localhost:8080/geoserver/tiger/wms",
            {
                layers: 'tiger:county10',
                format: 'image/png',
                visibility: true,
                isBaseLayer: true,
            });

        map.addLayer(wms);
        map.zoomToExtend(bounds);
    };
</script>
</head>
<body  onload="init()">
<h2>Test</h2>
<p>
    To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
</p>

<div id="map" style="width:800px; height:500px;" />
</body>
</html>
4

1 回答 1

0

Have you checked the Geoserver settings for zoom levels? You can set the min and max scales where to display each map layer.

于 2012-11-02T09:18:08.807 回答