Skip to content
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

Fork @types/mapbox-gl-js as well and possible inegrate directly with this repo #24

Closed
GarrettCannon opened this issue Dec 10, 2020 · 17 comments · Fixed by #130
Closed
Milestone

Comments

@GarrettCannon
Copy link

Moving this issues from the old repo into the new one.

Hello,

I definitely appreciate the efforts here. My suggestion would be to fork https://www.npmjs.com/package/@types/mapbox-gl as well to be used with this library.
Ideally it could be fully merged into this repo to further reduce fragmentation.
I don't know how the maintainers want to go about this, but if I can help let me know.

Thanks!

@snickell
Copy link
Contributor

Key questions: do we have any developers with a typescript interest + good type system knowledge + want to continue to maintain and spend time on these? If we do, I think eventually having types in the same org is a good idea, if not, DefinitelyTyped might do a better job than us, and perhaps we should just consider reaching out to them?

@nyurik
Copy link
Member

nyurik commented Dec 11, 2020

I have done some typescripting, and generally would prefer us to eventually move all maplibre to *.ts. I wonder how others feel about it (this should probably be a separate issue though, with a bunch of subissues)

@tomchadwin
Copy link

do we have any developers with a typescript interest + good type system knowledge

@JamesLMilner

@HarelM
Copy link
Member

HarelM commented Dec 11, 2020

I'm interested. I'm working only with typescript.
Feel free to tag me for any typescript issues.
I feel strongly about using typescript instead of flow (that's what's in here...? almost didn't find any library that uses it...) and would like to help out with the migration if this is something that more people are interested in (as Said, this is another issue).
Once you convert the code to typescript the definitions are for free :-)
But until then, it shouldn't be hard to move the definition files here and reference them from package.json file.

@GarrettCannon
Copy link
Author

Same here, I'm pretty experience with TS and would be willing to help out where needed. Just point me in the right direction!

@zakjan
Copy link

zakjan commented Dec 11, 2020

Same here. I have a concern about dependent libraries with Mapbox as peer dependency. Examples: various wrappers for frameworks (Vue, React, ...), or my cytoscape-mapbox-gl. They can't simply update to Maplibre, because it would prevent devs using them with Mapbox 2. Either dependent libraries need to split into two and duplicate all further changes, or support both Mapbox and Maplibre in the same library. Since the API is stable, I think there is no need to split, if we can describe in TS type system that a dependant library can use either Mapbox or Maplibre.

There is a similar situation in graphology libraries, they all depend on graphology-types, but the current solution feels clunky. I'm wondering if there is a better option.

@HarelM
Copy link
Member

HarelM commented Dec 11, 2020

The libraries will eventually diverge I believe, so if the library here had its typings inside there won't be a problem...

@GarrettCannon
Copy link
Author

I guess that is a valid question for the maintainers. Is this library meant to always be a drop in replacement for mapbox-gl-js or is the plan to diverge with our own priorities?

@zakjan
Copy link

zakjan commented Dec 11, 2020

There is 500 libraries depending on Mapbox. https://www.npmjs.com/package/mapbox-gl?activeTab=dependents It doesn't seem realistic to update them all. Another option would be to use npm/yarn alias.

@snickell
Copy link
Contributor

This library is not meant to be a drop-in replacement for mapbox-gl-js v2, that is an impossible chase

@snickell
Copy link
Contributor

We'll explore updating bindings in v1.14, for v1.13 we're focused on as drop-in as possible, but generally, yes aliases are probably the way to go here.

I suspect many/most open source binding authors will over the long term prefer not to become bindings to a closed source project, but for now, they'll want to "straddle" and aliases give a good way to do that wrt to peer deps.

@folke
Copy link

folke commented Dec 15, 2020

@types/maplibre-gl has just been released on npm. It's a copy of the mapbox-gl types for 1.13.0

@klokan klokan added this to the 1.15.0 milestone Mar 26, 2021
@klokan
Copy link
Member

klokan commented Mar 26, 2021

Can we update to 0.14.0 please?

@folke

Is this possible to automate generation for these with the release automation - as it was done in #95 ?

@HarelM
Copy link
Member

HarelM commented Mar 26, 2021

Is there an objection to integrate the typings file into this repository? I don't see a value in creating an npm @types package. Am I missing any thing?

@folke
Copy link

folke commented Mar 29, 2021

@klokan I'm no longer working on any projects using mapping, so would be great if someone wants to take over maintenance of the typings.

@HarelM makes sense to integrate the typings into the repo for sure.

@HarelM
Copy link
Member

HarelM commented Mar 29, 2021

I don't mind taking over the maintenance of the typings as long as it's in this repo so that there's no need to do anything special when releasing a version...
Unfortunately, I don't have maintainers permission so all I can do it a pull request, but I need to know if this is the direction that the @maintainers would like to go before sending the PR. I can check in the slack of the project to make sure...

@HarelM
Copy link
Member

HarelM commented Apr 9, 2021

I've created a pull request. Please let me know what else is missing in order to move this forward.

nyurik added a commit that referenced this issue Apr 13, 2021
* Fork @types/mapbox-gl-js as well and possible inegrate directly with this repo #24 - initial commit

* #24 - Added typescript item to change log

* #24 - Updated version to match the current one in package.json file

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
HarelM added a commit that referenced this issue Jun 16, 2021
HarelM added a commit that referenced this issue May 12, 2022
* A working prototype, which adds 3d-terrain to maplibre-gl. Sadly, during the
development i did no intermediate commits, so in this first commit all the
following functionality is included:

* allow MTK terrainRGB-tiles encoding with parameters:
  [6553.6, 25.6, 0.03, 10000.0]. In our opinion 0.1 for height-steps is to
  rough.
* create a TerrainSourceCache.js class which is similar to SourceCache.js and
  holds all the terrain-tiles used for the 3D-mesh. If a terrainRGB tile is
  used in both, terrain & hillshading, it is loaded twice. This makes the
  whole process much more easy.
* create a 3d-mesh in raster_dem_tile_worker_source.js with the martini
  library.
* rewrite the draw logic to render all layers, except symbols, into a
  framebuffer. This framebuffer a later used as a texture onto the 3d-mesh.
* rewrite symbol rendering to use 3d-coordinates. This is done with an extra
  a_ele shader parameter, because the z-value of the a_pos variable is already
  used for other things.
* add the third dimension into the collision index.
* create a terrain.html test-page.

* render more tiles to avoid wholes on tiled maps at canvas bottom

* Proof of concept! to get mercator-coords from the 3d-mesh on screen.
This is done with an extra framebuffer in which all tile coordinates are
rendered in an encoded rgb value. Dont know why, but this framebuffer looks
very inperformant. As advantage, grabbing coordinates from screen
is very fast. It may help to render the framebuffer only every 100ms instead
of every requestAnimationFrame?
This logic is currently used in
* map.project
* map.unproject.
Other usecases are:
* elevate camera over terrain
* use in mouse-events
* use in queryRenderedFeatures

* fix bug in picking correct coords from coordsFramebuffer

* Add Depthbuffer to RTT Framebuffer

* add z-dimension to circle layers

* switch to regular grid, correct rendering below ZL14, remove visible tile-boundaries

* fix raster-rendering, hacky performance improvement

* add z-dimension to fill-extrusion

* fix regular grid

* hide symbols behind terrain

* calculate elevation of symbol/circle/extrusion only once

* render coords-framebuffer only on camera movement

* improve performacne: render layers to texture only once

* * raise camera to correct zoomlevel-distance over terrain
* add exaggeration setting in TerrainSourceCache
* fix farZ clipping-plane
* set points: any declaration to Array<Object>

* Add an elevation offset of 450m to put the dead sea into positive values

* add yarn.lock file with martini entries

* render tiles only if terrain is loaded

* reuse framebuffer objects during rtt rendering

* reuse regular-mesh in all tiles

* add transform.elevation

* create transform.invProjMatrix before elevation correcture

* * move exaggeration calculation into shaders
* new more performant encoding of the coords-framebuffer

* some minor fixes, add map.addTerrain and map.removeTerrain

* refactor texture rendering

* decrease the number of framebuffers
* decrease the number of framebuffer/texture switches
* more caching and less re-rendering

the old render-pipeline renders layer by layer,
which is ok to render on display framebuffer, but when
rendering into a textures it is more performant to render all
necessary layers at once.

* moved elevation-calculation to GPU

This checkin is only for backup, so do not test!

* changed elevation calculation from CPU to GPU

This change had a big impact in performacne. To calculate the hight in
CPU sometimes about 100ms per tile was needed. When loading a lot of
tiles the framerate was really bad. This works now much better.
NOTE: Currently only the Mesh elevation is moved to GPU, symbols are
still calculated via the CPU.

* refactor render to texture workflow below ZL 14

Until now, below ZL 14 (e.g. our Vector-Tile maxzoom) the tile-size
increased with ZL, so ZL 1-14 had 1024px, ZL 15 2048px, ZL 16 4096px,
and so on. This was very easy to program, but needed also a lot of GPU
performacne and RAM. So now, the TerrainSourceCache holds tiles for each
zoomlevel of the size 1024, and below ZL 14 in each is renderd a
sub-region of ZL 14.

* refactor the coords-framebuffer.

Also the coords-framebuffer use a textures with 1024px in size. To avoid
bluring the texture below ZL 14 an additional small texture is needed
(u_coords_index) which holds in its RGBA values the tile quadrants of
the sub-regions.
NOTE: This is currently a work in progress!

* fix calculate_visibility in overzoomed terrain-tiles

* add very basic logic of loading tiles in respect of their elevation

* correct unprojecting coordinates

* correct calculation of elevation in CPU for different maxzoom settings

* calcuate symbol visibility via a depth-framebuffer, because the coords-framebuffer visibility calculation gets to wired if terrain-tiles & vector-tiles has different maxzoom settings

* fix symbol flickering

* typo

* move symbol/circle/fill_extrusion height calculation to GPU

* bugfix when rerender tiles, closes #24

* * free GPU less aggressive
* add deltaZoom setting to load less detailed terraintiles
* fix bug in _emptyDemTexture
* redraw only necesarry tiles (this still has bugs!)

* bugfix with TerrainSourceCache.deltaZoom

* * bugfix in u_terrain_matrix
* remember texture-coords to know which tile has to rerender
* disable raster fading if 3d is enabled

* add linear interpolation

* remove visible tile-boundaries

* reimplement deltaZoom

* fix marker wobbling & check visibility

* some code cleanup

* ...

* use preloaded terraintiles when zooming in and out

* ...

* bugfix for empty render-to-texture stack

* set LOD tile-loading in case of terrain3d

* avoid double-rendering (because of fading logic) of raster tiles

* calculate_visibility now checks visibility also some pixels above

* ...

* add code-documentation

* remove mtk raster-dem tiles hack

* add more minor fixes and add some comments

* bugfix for collision-index calculation with disabled 3d,
fixes #38

* revert old fill_extrusion_bucket centroid code,
because new logic had bugs

* fixes #36

* Update CHANGELOG.md

* Revert "Update CHANGELOG.md"

This reverts commit 0b81a41.

* attribution fixes (from astridx)

a1272d9

b9b0370

* Update .gitignore

* fix missing new line lint complained about

* first try (not finished) to leave the camera at the same height when dragging map.

* Revert "attribution fixes (from astridx)"

This reverts commit 2031d8e.

* Create a TerrainControl to toggle terrain

* fix tabs and comment

* change exaggeration type to number. add options to control example

* change terrain icon fill color when enabled

remove second "flat/enabled" svg. used color from gps location button.

* revert some merge changes

* Revert package-lock.json for pull request

* some improvements leave the camera in the same height during paning

* set default pitch back to 65, because of too much labels & missing sky

* fix "mismatched image size" errors in some of our stylesheets

* add default values during tinySDF generation

* fire "terrain" events

* let use TerrainControl use terrain-Event

* typo

* may fix farZ clippingplane calculation

* fix TileID-order of transform.coveringTiles result

* call transform.updateElevation on every rendering

* rerender rtt tiles on geojson.setData

* freezeElevation while camera-easing

* make tests running

* speedup symbol-placement in 2D mode

* ...

* add first very poor TerrainSourceCache test

* ...

* show correct tileBoundaries & collisionBoxes in terrain

* load LOD tiles in respect of terrain

* rename getElevationWithExaggeration to getElevation

* calculate tileDistanceToCamera form future-use in tile reduction algorithm

* update terrain-test page to maxPitch = 85

* Fix some lint warnings

* Fix some lint warnings

* lint warning fixes

* Improve typings, fix lint warnings

* Add type to getElevation parameter

* Update collision expected again?

* calculate farZ clipping-plane in respect of  transform.getHorizon

* reduce number of loaded tiles

* fix transform.locationPoint in 3d-mode

* fix not rendered areas in high zoomlevels

* fix typescript errors

* fix mouse zoom & tilt logic in 2D

* if last layer is a rtt layer, do not render it twice, fixes #1036

* correct calculation of queryRenderedFeatures coordinates in 3d-mode. fixes #1075

* Fix build typescript generation

* remove fixme's and create issues for that

* Small code fixes to avoid review comments

* Fix lint

* Fix draw_symbol unit test

* Fix unit test

* Remove console.log

* Fix build

* refacture TerrainSourceCache class

* fix lint errors

* add tests for sourceCache.usedForTerrain partent-tile-logic

* minor fixes

* Added some types and minor changes.

* encapsulate a_centroid shader attributes to #TERRAIN3D preprocessor

* remove terrain-instance from transform class, instead put as argument

* add forgotten return statements

* Add terrain to style spec (#1138)

* Add terrain to style spec

* Fix lint

* Added a test in style to make sure the terrain is created.

* fix lint

* Added validator to terrain object

* update some code-comments

* do not upload fill-extrusion centroid vertextbuffer in 2d

* transform.elevation setter: do not set unmodified state to let map.load event set correct map-location

* fix minor bugs when enable/disable terrain

* fix lint

* add test for recalcuateZoom

* Fixes related to console errors and some typings improvement in terrain branch (#1182)

* Fixes related to console errors and some typings improvement

* Fix lint

* Added -1 for terrain calculation, added a test, fixed public field

* Add typings

* Use MapTiler terrain tiles (#1184)

* Use MapTiler terrain tiles

* Default location Innsbruck, add terrain control

* Remove terrain_control debug page

* remove freezeElevation event when disable terrain3d, fixes #1185

* Fixes #1186 - add typeof guard check

* Terrain3D symbol cutoff at horizon (#1188)

* implement collision-index perspective cutoff logic

* getBounds calculate corners based on visible horizion

* add tests

* Use demotiles.maplibre.org (#1190)

* Fix terrain source button (#1192)

* When terrain is on, render last layer correct, fixes #1124 (#1189)

* when terrain is on render last layer correct, fixes #1124

* Added test to verify the bug

* Fix lint

Co-authored-by: HarelM <harel.mazor@gmail.com>

* Fix lint

Co-authored-by: max demmelbauer <max@toursprung.com>
Co-authored-by: Andrew Calcutt <acalcutt@techidiots.net>
Co-authored-by: acalcutt <acalcutt@worcester.edu>
Co-authored-by: HarelM <harel.mazor@gmail.com>
mfedderly pushed a commit to mfedderly/maplibre-gl-js that referenced this issue Jun 6, 2023
…nt (maplibre#24)

* shouldPausePlacement short circuits when _forceFullPlacement

* Add generated changelog entries

Co-authored-by: svc-changelog <svc-changelog@palantir.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants