英文:
Issues related to WMS tile layer options (WMSTileLayerOptions not caching) using flutter_map_tile_caching: ^8.0.0
问题
I am using flutter_map_tile_cache库来缓存瓦片,但我无法缓存WMSTileLayerOptions图层,请提供任何解决方案。
TileLayer(
wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.xyz.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary'],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: FMTC.instance('mapStore').getTileProvider(),
),
出现以下错误:- FMTCBrowsingError:无法从缓存或网络加载瓦片,因为缓存中缺少该瓦片并且无法建立与服务器的连接。
英文:
I am using flutter_map_tile_cache lib to cache tile but I am not able to cache WMSTileLayerOptions layers please provide any solution
TileLayer(
wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.xyz.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: FMTC.instance('mapStore').getTileProvider(),
),
getting error like this:- FMTCBrowsingError: Failed to load the tile from the cache or the network because it was missing from the cache and a connection to the server could not be established.
答案1
得分: 0
以下是翻译好的部分:
"flutter_map" 和 "cached_network_image" 可以满足我们的需求。
我们需要按照以下方式实现:
class CachedNetworkTileProvider extends TileProvider {
@override
ImageProvider getImage(TileCoordinates coordinates, TileLayer options)
{
return CachedNetworkImageProvider(getTileUrl(coordinates, options));
}
}
和
TileLayer(wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.example.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary'],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: CachedNetworkTileProvider(),
),
希望这对你有帮助。如果有其他翻译需求,请告诉我。
英文:
The flutter libraries "flutter_map" and "cached_network_image" can fulfill our requirements.
We need to implement like this:
class CachedNetworkTileProvider extends TileProvider {
@override
ImageProvider getImage(TileCoordinates coordinates, TileLayer options)
{
return CachedNetworkImageProvider(getTileUrl(coordinates, options));
}
}
And
TileLayer(wmsOptions: WMSTileLayerOptions(
baseUrl: 'https://apps.example.com:8080/myserver/wms/?',
layers: ['XYZLAYER:stateboundary'],
format: 'image/png',
transparent: true,
),
backgroundColor: Colors.transparent,
userAgentPackageName: 'com.example.xyz',
tileProvider: CachedNetworkTileProvider(),
),
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论