"Type '{ type: string; longitude: number; latitude: number; }' has no properties in common with type 'GeometryProperties'." angular 11 上的错误
"Type '{ type: string; longitude: number; latitude: number; }' has no properties in common with type 'GeometryProperties'." error on angular 11
我按照“https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-angular-cli”上的每条说明进行操作,并尝试使用以下代码片段向地图添加一个点。
const graphicsLayer = new GraphicsLayer();
sMap.add(graphicsLayer);
var point = {
type: "point",
longitude: -71.2643,
latitude: 42.0909
};
const simpleMarkerSymbol = {
type: "simple-marker",
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 1
}
};
const pointGraphic = new Graphic({
geometry:point,
symbol: simpleMarkerSymbol
});
graphicsLayer.add(pointGraphic);
但是我明白了
输入'{ 类型:字符串;经度:数字;纬度:数字; }' 与类型 'GeometryProperties' 没有共同的属性
错误。不知道为什么。
而不是使用
变量点={}
我用了
var point=new Point({});
代码会像,
import Point from '@arcgis/core/geometry/Point';
...
var point=new Point({
longitude:-117.173138,
latitude: 34.049599
});
...
我按照“https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-angular-cli”上的每条说明进行操作,并尝试使用以下代码片段向地图添加一个点。
const graphicsLayer = new GraphicsLayer();
sMap.add(graphicsLayer);
var point = {
type: "point",
longitude: -71.2643,
latitude: 42.0909
};
const simpleMarkerSymbol = {
type: "simple-marker",
color: [226, 119, 40],
outline: {
color: [255, 255, 255],
width: 1
}
};
const pointGraphic = new Graphic({
geometry:point,
symbol: simpleMarkerSymbol
});
graphicsLayer.add(pointGraphic);
但是我明白了 输入'{ 类型:字符串;经度:数字;纬度:数字; }' 与类型 'GeometryProperties' 没有共同的属性 错误。不知道为什么。
而不是使用 变量点={} 我用了 var point=new Point({});
代码会像,
import Point from '@arcgis/core/geometry/Point';
...
var point=new Point({
longitude:-117.173138,
latitude: 34.049599
});
...