问题描述
我想在地图上显示geojson,但是问题是addDataSource方法仅接受来接收DataSource类型,而不接受GeoJsonDataSource或其他。
我遵循以下示例:https://www.harp.gl/docs/master/doc/classes/harp_geojson_datasource.geojsondatasource-1.html
const geoJsonDataProvider = new GeoJsonDataProvider(
"italy",new URL("resources/italy.json",window.location.href)
);
const geoJsonDataSource = new GeoJsonDataSource({
dataProvider: geoJsonDataProvider,styleSetName: "geojson"
});
mapView.addDataSource(geoJsonDataSource); //error of type here
我遇到此错误:
Argument of type 'GeoJsonDataSource' is not assignable to parameter of type 'DataSource'.
我不明白该方法如何接受其他类型的数据,例如GeoJsonDataSource。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)