-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Support max pitch > 60 #3731
Comments
Yes! We've discussed some ideas about this with @ansis recently. Basically we should change the tile loading algorithm so that it loads lower zoom tiles on farther side, depending on how small they appear when projected. |
| loads lower zoom tiles on farther side, depending on how small they appear when projected. That would be really neat. If not, just rendering blur / some sort of background color in the distance would work fine as well - at least it would unblock our use cases. |
Also, in deck.gl we are combining maps with general 3D geometry - so our main camera is a general projection matrix, which we currently have to constrain to fit with mapbox zoom and pitch limits. If we remove those constraints, this means that we could have pitch > 90 degrees! It would certainly be OK not to render the base map in this case (we won't be underground). But we might still want to see extrusions (like buildings) from your 3D styles when looking up from street level. Maybe this should be a separate issue? |
besides level-of-detail tile loading we'll also need to fix:
|
For our purposes it would be OK if the labels disappeared at high pitch levels. They probably wouldn't be very legible anyway? |
This would be really great! Any progress on this issue? |
@Mariusun not on the main part of the issue but we are making progress one some sub-problems like improved label placement |
I am new try to use mapboxGL. It's wonderful to change the slope. But I also have the need to pitch the map more to observe the 3D |
+1 This would also be useful for AR/VR Experiences for FPV and also when turning on 3D Buildings to look down streets |
Related: mapbox/mapbox-gl-native#9037. |
Any progress by now? |
@areknawo we've finished some of the tasks that were blocking this, but the feature itself is not being actively worked on right now. |
Alright, I have found my way around, thanks for information anyway. |
@areknawo How are you working around this? Any pointers would be really helpful! |
@Rushali it's basicaly like this:
prototypeAccessors.pitch.set = function (pitch ) { Transform.prototype._calcMatrices = function _calcMatrices () {
}; Transform.prototype.coveringTiles = function coveringTiles (
}; Transform.prototype.pointCoordinate = function pointCoordinate (p , zoom , forTiles) {
}; |
Any news on that? It would be really amazing to go beyond 60 degrees limit. |
Agreed ! I'm wondering where the progress is for this feature... To reiterate an earlier point, even just having some color for the distant tiles and disregarding any annotations etc would probably suffice for now! Thank you. |
On the native side, mapbox/mapbox-gl-native#12310 would increase the maximum pitch to 67.5° unconditionally, across all zoom levels. There’s also discussion in mapbox/mapbox-gl-native#6908 about allowing the maximum pitch to vary by zoom level, since that threshold is particularly constraining at high zoom levels. |
I have tried a currently feasible method. the mapbox-gl version i used is
prototypeAccessors.pitch.set = function(pitch) {
var MAX_PITCH = 85;
var MIN_PITCH = 0;
var p = util.clamp(pitch, MIN_PITCH, MAX_PITCH) / 180 * Math.PI;
if (this._pitch === p) {
return;
}
this._unmodified = false;
this._pitch = p;
this._calcMatrices();
};
Transform.prototype.coveringTiles = function coveringTiles(
options
) {
var z = this.coveringZoomLevel(options);
var actualZ = z;
if (options.minzoom !== undefined && z < options.minzoom) {
return [];
}
if (options.maxzoom !== undefined && z > options.maxzoom) {
z = options.maxzoom;
}
var centerCoord = this.pointCoordinate(this.centerPoint, z);
var centerPoint = new Point(centerCoord.column - 0.5, centerCoord.row - 0.5);
// limit high pitch(pitch>60) covering tiles loading
var initHeight = 0;
var calHeight = initHeight;
var HIGH_PITCH = 60;
var MAX_PITCH = 85;
if (this.pitch > HIGH_PITCH) {
var CLIP_HEIGHT = this.height / 2 / 1.07;
var CLIP_HEIGHT_ADJUST = 0.08;
var pitchPercent = (this.pitch - HIGH_PITCH) / (MAX_PITCH - HIGH_PITCH);
var zoomPercent = (this.zoom - this.minZoom) / (this.maxZoom - this.minZoom);
var adjustAcordingZoom = 1 - zoomPercent;
var adjustPercent = 1 + adjustAcordingZoom * CLIP_HEIGHT_ADJUST;
calHeight = pitchPercent * CLIP_HEIGHT * adjustPercent;
}
var cornerCoords = [
this.pointCoordinate(new Point(0, calHeight), z),
this.pointCoordinate(new Point(this.width, calHeight), z),
this.pointCoordinate(new Point(this.width, this.height), z),
this.pointCoordinate(new Point(0, this.height), z)
];
return tileCover(z, cornerCoords, options.reparseOverscaled ? actualZ : z, this._renderWorldCopies)
.sort(function(a, b) {
return centerPoint.dist(a.canonical) - centerPoint.dist(b.canonical);
});
}; that is a way i using now, hope that can help you. |
@web-wyj Thanks. This is just what I needed |
yes |
@web-wyj |
You can search the function name 'prototypeAccessors.pitch.set' and 'Transform.prototype.coveringTiles' in |
@web-wyj
Thanks a lot, |
You misunderstood me. I'm just not good at speaking English. |
Hello everyone! Thanks for this thread! I used your snippets and it worked like a charm. I am wondering if, maybe, you would have some clues on where to look to be able to either: completely control the camera (taking over the camera in three js so I can manipulate it the way I want, even if that means not rendering the map in specific cases), or to just be able to turn the camera so it could 'look at the sky'? Thanks! |
Given this ticket is more about setting a pitch above the current limit of 60, I've renamed this ticket. Since #8834 lets you configure max pitch currently, just not beyond 60. |
FWIW @web-wyj's hack from last year no longer works because |
So now that we have @mpulkki-mapbox's awesome work from #8975 merged, are there any issues with flicking the switch and increasing the maximum allowable pitch ( Line 111 in 51d75fc
From my testing it seems to be working great after changing the defaultMaxPitch to 85. Even setting to 90 nothing crashes! |
@andrewharvey we want to do some improvements to label placement & collision behavior before we can increase the default limit — stay tuned for news from @mpulkki-mapbox on that front! |
Hi @andrewharvey so, if I need to use a little more pitch angle I just need to replace the .js on that link instead the 1.12.0 version that one's normally use? Sorry if it's a silly question but I'm totally new on this. I tried before with the other .js that someone posted but then the browser said that there was a missin .css file even when in my code there was still the link to the regular.css (the one from mapbox site) so that's why I'm not sure how to include a new .js on my code. Thanks, |
I changed defaultMaxPitch to 85/90 in mapbox-gl-js/src/ui/map.js and it did not have any effect on the max pitch for me. |
As a workaround, you can use TerrainLayer - that will go > 90 pitch no problem. |
It does not seem like that is an initial functionality: |
Sure - here's a codepen https://codepen.io/neonninja/pen/eYzQEQq |
Thanks a lot for the example. It seems that this is then a deckGL mapbox implementation? |
I don't think TerrainLayer relies on mapbox at all, except as a tile provider. To clarify, my suggested workaround was to use TerrainLayer as your basemap, and disable the mapbox.gl basemap. I think the more imminent problem there is that you're hitting the hardcoded limit of 60. The deck.gl layer can then go beyond while the map stays stuck at 60. |
Unlocked pitch to up to 85 degrees was added as part of the v2 release: #10160. |
As we improve support for custom rendering, there are legitimate cases for pitching the map beyond the hardcoded limit of 60 degrees. With the proper safeguards to prevent loading an absurd # of tiles, we could make the max pitch of the map configurable.
The text was updated successfully, but these errors were encountered: