我安装了 GeoServer 和为了测试,我添加了一个这样的层:
在 flutter 方面,我正在使用 flutter_map :
return FlutterMap(
mapController: controller,
options: MapOptions(
zoom: 6,
minZoom: 2.0,
maxZoom: 18.0,
center: widget.point,
onPositionChanged: widget.onPositionChanged,
),
nonRotatedChildren: [
AttributionWidget.defaultWidget(
source: 'OpenStreetMap contributors',
onSourceTapped: null,
),
],
children: [
TileLayer(
wmsOptions: WMSTileLayerOptions(
crs: const Epsg4326(),
baseUrl: 'http://localhost/geoserver/EazyCityDBWS/wms?',
layers: ['EazyCityDBWS:Provinces'],
),
),
TileLayer(
urlTemplate: 'https://b.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',
userAgentPackageName: 'com.example.app',
subdomains: const ['a', 'b', 'c'],
),
但是运行应用程序后我只看到地图,而不是我的图层。我检查了浏览器的检查工具:
所有图片都是空的?有人有在 Flutter 上使用 WMS 的经验吗?
这看起来很像如果图层是“边界”图层而不是多边形图层时会得到的结果,并且仍然会尝试对其应用多边形样式。
根据 SLD 规范,如果有一条线并对其应用多边形样式,则必须通过连接起点和终点来闭合线,然后填充生成的多边形。