Mapbox - extruding lines

怎甘沉沦 提交于 2019-12-14 02:22:57

问题


Is it possible to apply fill-extrusion for a GeoJSON LineString feature? Basically I'm looking for a way to draw lines (can be 1 line or multiple connected) in a 3d mode with z-offset.

If that's not possible, maybe this can be done with a polygon instead? Like, converting my lines to polygons (how can i do that?)


回答1:


What you're asking for isn't yet implemented, but ticketed in Mapbox GL JS at https://github.com/mapbox/mapbox-gl-js/issues/3993.

For now you'll need to opt for your second suggestion of converting the LineString feature to a Polygon. You can do this with turf's buffer function http://turfjs.org/docs#buffer.

The whole line/polygon will be offset at the same height, so depending on your application you could use turf's linkChunk http://turfjs.org/docs#lineChunk to get it broken up into smaller features which you assign different height properties to.



来源:https://stackoverflow.com/questions/47283304/mapbox-extruding-lines

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!