MapBox,它能使用GeoJSON文件中的z坐标使线条“悬浮”在地面上吗?

huangapple go评论53阅读模式
英文:

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-heightfill-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.

huangapple
  • 本文由 发表于 2023年5月17日 22:00:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76272953.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定