[英]How to use GeoJson as a Formatconstructor on DragAndDrop in Openlayers
我從openlayers遵循了這個例子: https://openlayers.org/en/latest/examples/drag-and-drop.html
但是我的項目是建立在 typescript 之上的,並且 Geojson 格式給出了以下錯誤:
“typeof GeoJSON”類型缺少“FeatureFormat”類型的以下屬性:dataProjection、defaultFeatureProjection、adaptOptions、getReadOptions 等 8 個。
這是我使用的代碼,錯誤出現在格式構造器中的 Geojson 上。
import { defaults, DragAndDrop } from 'ol/interaction';
import {GeoJSON} from 'ol/format';
this.dragAndDropInteraction = new DragAndDrop({
formatConstructors: [GeoJSON]
})
解決方案是否決 typescript 檢查如下
this.dragAndDropInteraction = new DragAndDrop({
formatConstructors: [GeoJSON as any]
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.