我正在尝试将mapbox / geojson-vt与传单一起使用,它没有呈现LineString几何形状

问题描述

我正在尝试在Leaflet地图上实现geojson-vt(https://github.com/mapbox/geojson-vt)。我可以渲染polygon,但是即使我已设置lineMetrics:true,geojson-vt也不渲染Linestring。我试图直接在地图上渲染Linestring,但是可以通过geojson-vt正常工作。

    parseGeoJSONArray() {
        this.parseVT({type: "FeatureCollection",features:[
                  {
                    "type": "Feature","properties": {
                      "dataType": "topology"
                    },"geometry": {
                      "type": "polygon","coordinates": [
                        [
                          [
                            -96.9391940144543,32.8664735931367
                          ],[
                            -96.9392595850587,32.866428752984
                          ],[
                            -96.9392587474335,32.8664278888345
                          ],[
                            -96.9392265210577,32.8664499266917
                          ],[
                            -96.9392065469181,32.8664293200505
                          ],[
                            -96.939238773294,32.8664072821933
                          ],[
                            -96.9392379356688,32.8664064180439
                          ],[
                            -96.9392368435343,32.8664071648949
                          ],[
                            -96.9392057092929,32.866428455901
                          ],[
                            -96.9391857351533,32.8664078492599
                          ],[
                            -96.9392168966981,32.8663865395824
                          ],[
                            -96.9392180474394,32.8663859000334
                          ],[
                            -96.9392171239039,32.8663849472532
                          ],[
                            -96.9391515532995,32.866429787406
                          ],[
                            -96.9391523909247,32.8664306515554
                          ],[
                            -96.9391846703222,32.8664085774396
                          ],[
                            -96.9392046444618,32.8664291840808
                          ],[
                            -96.9391723650643,32.8664512581966
                          ],[
                            -96.9391732026895,32.8664521223461
                          ],[
                            -96.9391742811722,32.8664513848307
                          ],[
                            -96.939205482087,32.8664300482303
                          ],[
                            -96.9392254562266,32.8664506548714
                          ],[
                            -96.9391931768291,32.8664727289872
                          ],[
                            -96.9391940144543,32.8664735931367
                          ]
                        ]
                      ]
                    }
                  },{
                    "type": "Feature","geometry": {
                      "type": "Linestring","coordinates": [
                        [
                          -96.9392379356688,32.8664064180439,0
                        ],[
                          -96.9392057092929,32.866428455901,0
                        ]
                      ]
                    }
                  },"coordinates": [
                        [
                          -96.9392046444618,32.8664291840808,[
                          -96.9391723650643,32.8664512581966,0
                        ]
                      ]
                    }
                  }
  ]});  
}


parseVT(data){
  var tileIndex = geojsonvt(data,{
  maxZoom: 19,// max zoom to preserve detail on; can't be higher than 24
  tolerance: 3,// simplification tolerance (higher means simpler)
  extent: 4096,// tile extent (both width and height)
  buffer: 64,// tile buffer on each side
  debug: 0,// logging level (0 to disable,1 or 2)
  lineMetrics: true,// whether to enable line metrics tracking for    Linestring/MultiLinestring features
  indexMaxZoom: 5,// max zoom in the initial tile index
  indexMaxPoints: 100000 // max number of points per tile in the index
});
console.log(tileIndex.tileCoords);
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)