英文:
MapBox, can it use the z-coordinate in a GeoJSON file to make lines "hover" over the ground?
问题
在MapBox中,是否有一种方法可以使用z坐标使GeoJSON文件中的线段“悬浮”在地面上?
我有一个带有x、y和z坐标的GeoJSON文件。x和y坐标采用EPSG:4326。GeoJSON的定义允许z坐标以米为单位。
GeoJSON的格式如下:
{
"type": "FeatureCollection",
"name": "centros_lat",
"crs": { "type": "name", "properties": { "name":"urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{
"type": "Feature",
"properties": { "Id": "center01"},
"geometry": {
"type": "LineString",
"coordinates": [ [ -3.235834, 38.832989, 32 ], [ -3.234574, 38.834453, 32 ], ...]
}
}, ....
]
}
在MapBox中使用这个GeoJSON作为数据源是可以的,但它只会在地形上显示线段,并似乎并未使用z坐标。
英文:
In MapBox, is there a way to use the z coordinate to make lines in a GeoJSON file "hover" above ground?
I have a GeoJSON file with lines with x, y and z coordinates. The x and y coordinates are in EPSG: 4326. The definition of GeoJSON allows the z coordinate to be meters.
The GeoJSON is something like this:
<
{"type": "FeatureCollection",
"name": "centros_lat",
"crs": { "type": "name", "properties": { "name":"urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature",
"properties": { "Id": "center01"},
"geometry": { "type": "LineString",
"coordinates": [ [ -3.235834, 38.832989, 32 ], [ -3.234574, 38.834453, 32 ], ...]
}
}, ....
]
}
>
Using this GeoJSON as a source in MapBox works just fine, but it just displays the line on the terrain level and does not seem to be using the z coordinate at all.
答案1
得分: 1
Mapbox GL JS不支持抬高地面的LineString要素。
如果您将LineString转换为具有某种厚度的多边形,然后使用fill-extrusion
类型显示它,可以有一种解决方法,使用fill-extrusion-height
和fill-extrusion-base
来设置高度。
英文:
Mapbox GL JS does not support LineString features raised above the ground.
There is a kind of workaround if you convert the LineString to a Polygon (with some kind of thickness), then display it using a fill-extrusion
type, using fill-extrusion-height
and fill-extrusion-base
to set the elevation.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论