我正在开发一个 angular 应用程序,它使用传单地图来显示一些图层,我正在尝试使用 GeoJSON,但我无法创建 L.geoJSON 图层。我试图添加一个观点,我发现的每一个资源都告诉我要创建这个结构:
import { geoJSON } from 'leaflet';
geoJSON({
type: "Point",
coordinates: [lat,long]
});
Run Code Online (Sandbox Code Playgroud)
但是当我提供应用程序时,我收到此错误:
Argument of type '{ type: "Point"; coordinates: number[]; }' is not assignable to parameter of type 'GeoJsonObject'.
Object literal may only specify known properties, and 'coordinates' does not exist in type 'GeoJsonObject'.
Run Code Online (Sandbox Code Playgroud)
唯一的其他属性type是bbox?.
我确定我做错了什么,但我真的不明白是什么。
使用
"leaflet": "^1.3.1"
"@types/leaflet": "^1.2.5"
"@asymmetrik/ngx-leaflet": "^3.0.2"
Run Code Online (Sandbox Code Playgroud)