Openlayers 为什么多行线图层不能正确显示

Openlayers 为什么多行线图层不能正确显示,openlayers,Openlayers,onComponentDidMount,我运行一个函数: async mountPanoramasTiles() { await this.fetchPanoramTracks(); this.drawRoadsLayer(this.panoramasTracksLayer); 这个.drawRoadsLayer是下一个: drawRoadsLayer(geoJSON) { const { map, point } = this.props; const geoVector = new ol

onComponentDidMount,我运行一个函数:

async mountPanoramasTiles() {
await this.fetchPanoramTracks();
this.drawRoadsLayer(this.panoramasTracksLayer);
这个.drawRoadsLayer是下一个:

drawRoadsLayer(geoJSON) {
const { map, point } = this.props;

const geoVector = new ol.source.Vector({
  features: new ol.format.GeoJSON().readFeatures(geoJSON)
});

const tilesStyle = new ol.style.Style({
  stroke: new ol.style.Stroke({
    color: "blue",
    width: 1
  })
});

this.panoramasTracksLayer = new ol.layer.Vector({
  source: geoVector,
  style: tilesStyle
});
map.addLayer(this.panoramasTracksLayer);
我有一个来自服务器的响应,其中包含以下信息:

{"type":"Feature","id":"default_pano_shape.1","geometry":{"type":"MultiLineString","coordinates":[[[4162645.3515,7525239.799],[4162632.2158,7525249.9675],[4162622.9094,7525261.4838],[4162619.9373,7525275.8742],[4162622.5198,7525293.0397],[4162630.8019,7525307.0339],[4162644.0935,7525316.8061],[4162657.6077,7525321.504],[4162674.4211,7525324.5403]]]},"geometry_name":"geom","properties":{"objectid":1,"id":0,"shape_leng":127.622459436989288}
我使用geoJSON类型的数据,geoJSON和map的所有坐标格式都是相同的(EPSG:3857),但我看到的不是长线(道路),而是短截距


我做错了什么

geojson数据中存在错误。将代码粘贴到www.geojson.io,当您缺少一些大括号、数组深度级别等时,它将指导您。 祝你好运