在引入地图基础之上加载点的定位
let that = this;
let newView = new View({
projection: 'EPSG:4326',
center:coordinate,
zoom:14
})
that.map.setView(newView)
let geojsonObject = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates:coordinate
}
}
]
};
let features = new GeoJSON().readFeatures(geojsonObject)
that.pointPosition = new VectorLayer({
className:'pointFeature',
title:'pointFeature',
source:new VectorSource({
features
}),
style: new Style({
//填充色
// fill: new Fill({
// color: 'rgb(0,255,72)'
// }),
//边线颜色
stroke: new Stroke({
color: '#ff0008',
width: 4
}),
//形状
image: new Circle({
radius: 7,
fill: new Fill({
color: '#ff334b'
})
})
})
});
that.map.addLayer(that.pointPosition)