-
Notifications
You must be signed in to change notification settings - Fork 315
Description
Displaying geometries over a terrain with FeatureGeometryLayers requires to set the base_altitude style parameter.
This is complicated for the end-user, and does not refresh based on terrain refinement.
To me, most use-cases imply setting the object base altitude at ground level. I think that it could be a nice to have to be able to wrap any feature (Point, Line, Polygon) over the terrain by enabling a flag in FeatureGeometryLayer config.
The wfs 2.5d example does that by cheating a little bit with elevation offset for point and lines:

Context
If we look at the source_stream_wfs_25d example, here is how the the bus stop points are instanciated :
var lyonBusStopLayer = new itowns.FeatureGeometryLayer('lyon_tcl_bus_stop', {
source: lyonBusStopSource,
zoom: { min: 4 },
style: {
point: {
base_altitude: altitudeLine,
color: 'DarkTurquoise',
radius: 30,
}
}
});
The altitude_line function loosely provides the desired "wrapping effect". It does not refine when terrain subdivides and is not very handy for the end-user
Description of the proposal
We could provide an option flag like that instead :
var lyonBusStopLayer = new itowns.FeatureGeometryLayer('lyon_tcl_bus_stop', {
source: lyonBusStopSource,
zoom: { min: 4 },
clampOnTerrain: true,
style: {
point: {
color: 'DarkTurquoise',
radius: 30,
}
}
});
Concerns about performance and implementation complexity
Looking at some of iTowns competitors, it seems that no one wrap lines or polygons over terrain.
Points are usualy rendered as oriented textures in 3D space, and lines and polygons are rasterized on terrain. I make the hypothese that wrapping vector-rendered lines and polygons over the terrain is functionnaly and technically difficult. It might also introduce performance overhead. This would anyway be very useful for points, 3D objects or extruded polygons.
We could maybe take inspiration from these solutions and build some kind of hybrid layer bundling rasterized lines/polygons and vector points. I presume this will be the choosen solution in the end. @jailln I remember talking about this idea with you, but I can't find a proposal about it. Did we write one ?
Here are the reasons of this digression :
Mapbox rasterises lines and polygons on terrain. See this example. It can also "deflate terrain" when zoomed-in to switch to vector rendering. --> See geojson.io
Google earth does not apply elevation when using vectorial 'Map' style :
