通过jsbridge将geoserver图层添加到html时出错
c#
var function = "LoadAirLayerName('" + "air" + "')";
hybridwebview.getfunction = function;
html
function LoadAirLayerName(x) {
AirLayerName = x;
AirLayer = new ol.layer.Tile({
source: new ol.source.TileWMS({
url: GeoServerURL + '/geoserver/Layer/wms',
params: {
'LAYERS': AirLayerName,
'FORMAT': 'image/png8',
'CRS': 'EPSG:4326',
'TRANSPARENT': 'TRUE',
},
serverType: 'geoserver',
}),
minResolution: 0.01,
maxResolution: 20,
layerName: AirLayerName,
layerCategory: 'WMS',
type: 'WMS',
visible: true,
opacity: 0.8
});
}
c#
var function = "MapAddAir()";
hybridwebview.getfunction = function;
html
function MapAddAir() {
map.addLayer(AirLayer);
}
起初它正常工作。 但是我突然出现错误,无法在地图上添加图层。
错误代码 E / AndroidProtocolHandler(27314): 无法打开资产URL:file:/// android_asset / Content / undefined / geoserver / Layer / wms?SERVICE = WMS&VERSION = 1.3.0&REQUEST = GetMap&FORMAT = image%2Fpng8&TRANSPARENT = TRUE&LAYERS = air&CRS = EPSG%3A3857&WIDTH = 448&HEIGHT = FORM&STYOPLES = dpi%3A158&BBOX = 14107676.56248184%2C4515135.260805361%2C14107829.43653841%2C4515288.134861931