从某种意义上说,我有一些空间视图,它们从其他表中选择了一些空间列。该表是使用geoserver发布的。该表是活动的,有时根本没有数据。当表中没有数据时,显示的wms全部都存在,red
并且在Firebug控制台中的错误是:
WMS返回:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE
> ServiceExceptionReport SYSTEM
> "http://192.168.70.65:80/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException>
> java.lang.NullPointerException
> null
> </ServiceException></ServiceExceptionReport>
编码:
function init(){
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 1;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
map = new OpenLayers.Map('map', {
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
numZoomLevels: 21,
maxExtent: new OpenLayers.Bounds(-20037508, -20037508,20037508, 20037508.34),
controls: [
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.LayerSwitcher({'ascending':false}),
new OpenLayers.Control.ScaleLine(),
new OpenLayers.Control.MousePosition(),
new OpenLayers.Control.OverviewMap(),
new OpenLayers.Control.KeyboardDefaults()
]
});
使用GeoExt:
<script src="http://localhost/geoserver/www/ext/adapter/ext/ext-base.js" type="text/javascript"></script>
<script src="http://localhost/geoserver/www/ext/ext-all.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://localhost/geoserver/www/ext/resources/css/ext-all.css"/>
<link rel="stylesheet" href="http://localhost/geoserver/www/openLayers/theme/default/style.css" type="text/css" />
<script src="http://localhost/geoserver/www/openLayers/OpenLayers.js" type="text/javascript"></script>
<script src="http://localhost/geoserver/www/geoext/lib/GeoExt.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="http://localhost/geoserver/www/geoext/resources/css/geoext-all.css"/>
<script>
OpenLayers.Util.onImageLoadErrorColor = 1;
OpenLayers.Util.onImageLoadErrorColor = "transparent";
Ext.BLANK_IMAGE_URL = "http://localhost/geoserver/www/ext/resources/images/default/s.gif";
var app, items = [], controls = [];
var lon = 85.344;
var lat = 27.7;
var zoom = 12;
var url = "http://localhost/geoserver/wms";
Ext.onReady(function() {
app = new Ext.Viewport({
layout: "border",
items: items
});
你的问题是什么?
—
昏暗
@underdark当视图没有数据即没有行如上图的层
—
蜜熊
...而您想知道如何摆脱红砖?
—
昏暗
@underdark是有没有办法这样做
—
蜜熊