Closed atsyplenkov closed 1 month ago
I think this is because the center
and zoom
parameters are actually set to 0 when maplibregl
was created and are not updated.
m1 <- maplibre(bound = nc)
m1$x
#> $style
#> [1] "https://basemaps.cartocdn.com/gl/voyager-gl-style/style.json"
#>
#> $center
#> [1] 0 0
#>
#> $zoom
#> [1] 0
#>
#> $bearing
#> [1] 0
#>
#> $pitch
#> [1] 0
#>
#> $additional_params
#> $additional_params$bounds
#> [1] -81.74091 36.23444 -81.23971 36.58973
So maybe we can add some function to update center
and zoom
arguments here as well?
https://github.com/walkerke/mapgl/blob/796545570e64dc29c7126ec4d9198db038bb9e0e/R/maplibre.R#L32-L37
This is now fixed; we are now honoring the additional_params
on the JS side which gets us the exact same behavior as a regular map. I do really appreciate the PR, though!
Hi,
When one creates the
compare
slider widget with two maps that were created with thebounds
argument, thecompare
widget ignores thebounds
and dropscenter
andzoom
to default values. See the example below.How it works now
The workaround
Session Info