maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

Add ability to control feature altitude via a style spec property

Open cigone-openindoor opened this issue 3 years ago • 21 comments

Clone this issue: https://github.com/mapbox/mapbox-gl-js/issues/3993

The main idea is to provide the ability to have symbol (marker, images, text) at a given elevation.

It would be convenient to mix with extrusion capabilities, like for 3D buildings.

cigone-openindoor avatar Nov 16 '21 10:11 cigone-openindoor

this is the painpoint when using extrusion

yangjuncode avatar Nov 16 '21 13:11 yangjuncode

I second this feature ⭐

leehoss avatar Nov 17 '21 02:11 leehoss

Something like this would be useful for visualizing 3D paths as well. For example lines between two points in 3D space after #165 is implemented, or an implementation that allows for 3D measurement like Google Earth Pro does. There are many use cases like this and I think it would be a welcome addition from both GIS pros and users alike.

dechristopher avatar Jan 29 '22 16:01 dechristopher

Has there been any progress getting markers, points, or any object to render with a z-offset or altitude?

spencerthayer avatar Mar 17 '22 21:03 spencerthayer

I would suggest using a third element in position arrays of the source, as defined in GeoJSON spec.

An OPTIONAL third position element SHALL be the height in meters above the WGS 84 reference ellipsoid. https://datatracker.ietf.org/doc/html/draft-butler-geojson#section-3

This could be a starting point for 3D LineStrings, Points and maybe Polygons as well. For LineStrings, the third position element would make rich 3D Lines possible with more than two points (e.g. aircraft flight paths) opposed to fixed-height extrusion in style spec.

@wipfli maybe you can point me to the right parts of the code and I can give this a try. But I am a beginner with WebGL.

samuel-git avatar May 27 '22 10:05 samuel-git

I would look at the line_program related code.

HarelM avatar May 27 '22 14:05 HarelM

Oh this feature would be so cool. @samuel-git if you implement something like this I will immediately test it with my hot-air balloon GPS tracks...

wipfli avatar May 28 '22 08:05 wipfli

We have to display aircraft tracks and on a 3d map having them on the ground and vanishing behind mountains is not nice.

I definitely vote for using the optional 3rd geojson coordinate item, as it would also allow 3D-lines (e.g. the planned flight route or the actual flight path of aircrafts.

cns-solutions-admin avatar Aug 11 '22 08:08 cns-solutions-admin

Been waiting for this feature to help with indoor multilevel routing …. This would be a game changer , please let’s get momentum on this feature :)

leehoss avatar Aug 11 '22 21:08 leehoss

It would be awesome to have the addressed feature implemented! However, it might be a feasible alternative for now to use custom style layers for some of the use cases named above.

Here is a simple example of how that could look like: https://github.com/weglide/maplibre-3d-linestring-demo image

I am a WebGL beginner, and I assume the performance of this code is nowhere near its optimum, but it proves the possibility and might help some of you, too. Of course, feedback is welcome if someone has ideas for improvements :)

NFmax avatar Nov 21 '22 17:11 NFmax

@NFmax can you post your demo using github pages? I'm curious as to how this would look/interact...

HarelM avatar Nov 21 '22 17:11 HarelM

It should be possible to run this locally without any effort. Just download the .html file and open it with a browser ;)

NFmax avatar Nov 21 '22 18:11 NFmax

It is nice to have the file hosted somewhere to test with mobile devices. And it is also convenient...

wipfli avatar Nov 22 '22 07:11 wipfli

There are basically two different features here I think. The ability to add elevation to marker images, etc (original post) and the ability to add elevation to the geometry. I'll see if I can split those two and maybe assign bounties to them as part of the 3D terrain effort.

HarelM avatar Mar 16 '23 06:03 HarelM

See the following design proposal in the spec repo: https://github.com/maplibre/maplibre-gl-style-spec/issues/62 Feel free to join the discussion and suggest spec definitions to support this.

HarelM avatar Mar 19 '23 19:03 HarelM

While I think the demo repo here is great in terms of showing a proof of concept for 3D lines I think there's a problem with the underlaying source data in MVT format - MVT currently doesn't support elevation data so this need to be enriched in the client side somehow which is less than ideal. Bottom line, I think it's possible but I think it will require a big change in the code in order to actually support this in a decent way without "hacks". If someone would like to take a closer look at this feel free to do so.

HarelM avatar Mar 19 '23 19:03 HarelM

See my comment https://github.com/maplibre/maplibre-style-spec/issues/62#issuecomment-1683603898

Though MVT currently does not support 3D geometries, maplibre could do so (at least) internally, thus supporting both 3D symbol and 3D line geojson layers.

cns-solutions-admin avatar Aug 18 '23 09:08 cns-solutions-admin

Another interesting approach is the use of "buildings" to draw lines that are above the ground. See the demo in the below discussion. https://github.com/maplibre/maplibre-gl-js/discussions/3397 cc: @wiesehahn

HarelM avatar Nov 21 '23 09:11 HarelM

Is it possible for me to contribute to a public bounty for this feature? Willing to pay someone to work on this.

cozzbp avatar Dec 15 '23 16:12 cozzbp

Yes, the problem is finding someone who is willing to work on it. CC: @SnailBones, @CraigglesO

You can post in the slack channel to see if there is an interest to getting paid for it.

HarelM avatar Dec 17 '23 14:12 HarelM