-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popup's accepting altitude #9814
Comments
I'd like to see this supported too, both by We'd probably want to carefully consider the API to be consistent with 3D terrain (eg. |
if pitch >60 ,is coordinate conversion normali? @jscastro76 |
|
Has there been any progress getting markers, points, or any object to render with a z-offset or altitude? |
Waiting for this feature too. |
Waiting for this.. can't believe we don't have that utility yet.. you can set elevation basically everywhere, I'd love to have Popup acceptting height as well |
Any update? |
Motivation
First of all thanks for all the work you have been doing through the years with Mapbox. I know you're always open for feedback and suggestions, so here I go...
One of the features I've been missing a lot is the possibility to have popups with altitude for my fill-extrusions and my 3D models, so I finally implemented my own version using
THREE.CSS2DObject
, but honestly it's only a workaround that could be made withinpopup
class that is the proper place.Design
To implement these custom popups with altitude, it required to create a new
CSS2DRenderer
instance and call it's render method on therender
member of aCustomLayerInterface
new layer. Then, create aCSS2DObjetc
, add the HTML inside and set position.This is how it works using the default sample for 3D buildings adding a
queryRenderedFeatures
call on click to filter the extrusions at the point clicked, and then creating two popups in the same LngLat position, but one using the custom approach including altitude and the other one using the standardpopup
class. I usefeature.properties.height
of the clicked extrusion to create one of these custom popups. Position is quite stable on any camera pitch/zoom/bearing combination. I use a converter to project the LngLat + Alt coordinates to position properly.Implementation
I have updated the jsfiddle Add a 3D model with Popup in Altitude with a simplified sample for better understanding, comparing this custom popup with a standard Mapbox popup.
As far as I understand, the main difference (apart from the input of a third parameter for altitude) is the calculation of the css
translate
values foroffsetedPos.x
andoffsetedPos.y
final pixels done in_update
member, but I could be wrong. I'm aware this could be a major change for popup but I think it deserves the effort now that your maps are now supporting 3D models and fill-extrusions.Thanks in advance,
@jscastro76
The text was updated successfully, but these errors were encountered: