Giter Club home page Giter Club logo

maplibre-gl-js's People

Contributors

1ec5 avatar anandthakker avatar andrewharvey avatar ansis avatar astridx avatar bhousel avatar birkskyum avatar brunoabinader avatar chrisloer avatar dependabot[bot] avatar dmitrig01 avatar harelm avatar jfirebaugh avatar karimnaaji avatar katydecorah avatar kkaefer avatar mikemorris avatar mollymerp avatar mourner avatar peterqliu avatar pozdnyakov avatar ryanhamley avatar samanpwbb avatar scothis avatar tatsvc avatar tmcw avatar tristen avatar vicapow avatar wipfli avatar yhahn avatar

Forkers

aakaydin boswellp

maplibre-gl-js's Issues

[Improvement] trigger render-to-texture only on necessary tiles

Currently, when a new tile is loaded, all loaded tiles will be rerendered. This should be changed, and can be done in TerrainSourceCache.js at around line 80. I already started an approach, but it did not work correct. Those lines of code are currently commented out.

Label (clustering?) not working correctly

I am having an issue in the terrain3d branch where point label distribution does not seem to be working correctly.

This is my example with the terrain3d branch
https://stackblitz.com/edit/web-platform-wxkjfp?file=index.html
points_terrain3d

In this example, all the black circles should have a label, but you can see they are missing around the outer edge. If you move the screen around, the lables continue to stay in the center and out edge stays missing. Also, If you zoom in, you would expect more labels to be visible, but instead there are even less labels.

I have also tested this with the maplibre master branch (2.0.0 pre6) here
https://stackblitz.com/edit/web-platform-ddhwtr?file=index.html
points_2 0 0-pre6

In this second example, you can see the label distribution is more what you would expect. there is no missing border of labels and when you zoom in more labels can be seen

3D Tiles on top of Terrain

Hello prozessor13,

your project is awesome and its working amazing.
I have an application with additional data as 3D-Tiles (b3dm-files). Visualization is taken care of via Javascript-Code (mainly Three.js).

In 2D-Maps the data is shown, but when i add 3D it seems as it is blocked.
I dont know if this problem is due to your or my Code.
So do you allow to put objects on top? Maybe you can tell me which code snippet i should look into.

Regards,
Hendrik

Attribution bug

Just wanted to let you know that since the last merge with master, the terrain3d branch has this attribution bug ( maplibre#640 ) . I tested the upstream fix in my local copy and it works for me.

Other than that I wanted to comment that the 3d terrain has been working pretty well. My wifidb.net map is using the latest (ab0d337) with the fixes to attribution and I haven't had to many issues (except when i ran it on an older laptop...haha)

[Need Help] during panning, leave the camera in constant hight

Currently the camera is at a constant height, relatively to the altitude of the center-coordinate.

This should be changed, to that the camera is always on the same hight, relatively to the sea-level. To render the scene correct, it is necessary to recalculate the zoom-level on every map-movement.

Built in toggle button support

Motivation

Would it be possible to add toggle button for 3d terrain, similar to GeolocateControl or FullscreenControl that is built in to maplibre? I feel like this would make it easier to optionally use terrain.

Design

I have done this on my own site with this code and css. I used a terrain icon from svgrepo which looks good for show 3d terrain. For hide 3d terrain I removed the montains in the icon, which works but is kind of ugly (i had trouble thinking of something better)

javascript

/* Code to add a custom button. Idea from Stack Overflow https://stackoverflow.com/a/51683226  */
class MaplibreGLButtonControl {
  constructor({
	className = "",
	id = "",
	title = "",
	eventHandler = evtHndlr
  }) {
	this._className = className;
	this._id = id;
	this._title = title;
	this._eventHandler = eventHandler;
  }

  onAdd(map) {
	this._btn = document.createElement("button");
	this._btn.id = this._id;
	this._btn.className = "maplibregl-ctrl-icon" + " " + this._className;
	this._btn.type = "button";
	this._btn.title = this._title;
	this._btn.onclick = this._eventHandler;

	this._container = document.createElement("div");
	this._container.className = "maplibregl-ctrl-group maplibregl-ctrl";
	this._container.appendChild(this._btn);

	return this._container;
  }

  onRemove() {
	this._container.parentNode.removeChild(this._container);
	this._map = undefined;
  }
}

/* Toggle Terrain Function */
function terrain_toggle(event) {
	var el = document.getElementById(event.target.id);

	if ( el.classList.contains('maplibregl-terrain') )
	{
		map.addTerrain("terrain");
		el.title = "Hide 3d Terrain"
	} else {
		map.removeTerrain();
		el.title = "Show 3d Terrain"
	}

	el.classList.toggle('maplibregl-terrain');
	el.classList.toggle('maplibregl-terrain-hide');

}

/* Toggle Terrain Button */
const terrain_button = new MaplibreGLButtonControl({
  className: "maplibregl-terrain",
  id: "terrain_button",
  title: "Show 3d Terrain",
  eventHandler: terrain_toggle
});

map.addControl(terrain_button, "top-right");
/* End Custom Button to Toggle Terrain  */

css

.maplibregl-terrain {
	background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25px' height='25px' viewBox='-4 -4 25 25' version='1.1'%3E%3Cg id='surface1'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(0%25,0%25,0%25);fill-opacity:1;' d='M 1.996094 15.234375 L 7.054688 9.722656 L 10.566406 13.234375 L 14.292969 16.957031 L 15.394531 15.855469 L 11.632812 12.089844 L 16.003906 7.410156 L 22.988281 15.234375 L 24.21875 15.234375 L 24.21875 14.265625 L 16.027344 5.089844 L 10.527344 10.984375 L 7.007812 7.464844 L 0.78125 14.246094 L 0.78125 15.234375 Z M 1.996094 15.234375 '/%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(0%25,0%25,0%25);fill-opacity:1;' d='M 0.78125 19.140625 L 24.21875 19.140625 L 24.21875 20.703125 L 0.78125 20.703125 Z M 0.78125 19.140625 '/%3E%3C/g%3E%3C/svg%3E%0A");
}

.maplibregl-terrain-hide {
	background-image: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25px' height='25px' viewBox='-4 -4 25 25' version='1.1'%3E%3Cg id='surface1'%3E%3Cpath style=' stroke:none;fill-rule:nonzero;fill:rgb(0%25,0%25,0%25);fill-opacity:1;' d='M 0.78125 19.140625 L 24.21875 19.140625 L 24.21875 20.703125 L 0.78125 20.703125 Z M 0.78125 19.140625 '/%3E%3C/g%3E%3C/svg%3E%0A");
}

Mock-Up

terrain_icon

Flickering when zooming with terrain enabled

Hi prozessor13,

great work on the 3d feature, looks beautiful!

When testing your branch I noticed some flickering when zooming in (using the toursprung/terrain.json style) which is quite noticeable. It seems like semi-transparent polygons are rendered twice and for a few frames and the opacity is therefore doubled.
Edit: It only seems to happen on the first zooming of an area, when all tiles are cached it doesn't happen.

Tile in the southeast with wrong opacity:
2200ms

200ms later the tile is rendered correctly:
2400ms

This doesn't happen with terrain disabled, I think it's related to some networking activity (new DEM or image tiles available).

Any idea where that may come from? Happy to help if you can point me in the right direction.

Regards,
Florian

[Bug] Render to texture sometimes not render all layers

Sometimes render to texture is done, even if not all resources are fully loaded. Due to caching this leads in incomplete renderings. Especially this happens if a rendered tile is not fully visible in the current viewport.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.