yukinarit / mapbox-gl-rs Goto Github PK
View Code? Open in Web Editor NEWUnofficial Rust/WASM binding for mapbox-gl-js
License: MIT License
Unofficial Rust/WASM binding for mapbox-gl-js
License: MIT License
https://docs.mapbox.com/mapbox-gl-js/example/navigation/
#33 is required to implement this example
Build examples into WASM in GHA and push to gh-pages branch
Add Rust binding to GeolocateControl
This issue depends on #33
Add Rust binding to AttributionControl
This issue depends on #33
Hi, I am trying to display a map in a perseus
app. I have copied the mapbox-gl.js
into my project and mapped it to ./snippets/mapboxgl-89106e6563064742/mapbox-gl.js
.
When I visit the page with the map on it I get the following error.
Uncaught SyntaxError: The requested module './snippets/mapboxgl-89106e6563064742/mapbox-gl.js' does not provide an export named 'Map' (at bundle.js:1:10)
The pages setup is as follows.
When the page loads I run the following code (only in browser not SSR)
let map_state = state.map_state.get().as_ref().to_owned();
let options = MapOptions::new(
"pk.eyJ1IjoibGlhbTczNyIsImEiOiJjbDZpdzh1cGgweDc2M2RvMndja2xlOHFzIn0.b9nPCIMzEkN6qWYsSQMoog".into(),
"map".into(),
).center(LatLng {
lat: map_state.lat,
lng: map_state.lng,
}).zoom(map_state.zoom);
let mut map = MapFactory::new(options).unwrap();
map.set_listener(MapListener);
And add the following html to the page
<div id="map" class="w-screen h-screen"></div>
In the head I added the Mapbox css with the following
<link rel = "stylesheet" href = "https://api.mapbox.com/mapbox-gl-js/v2.10.0/mapbox-gl.css" />
Currently the map listener is empty, issue still occurs without a listener
struct MapListener;
impl MapEventListner for MapListener { }
When I visit the page, the page is blank and I get this in the dev tools
And when I open bundle.js in the dev tools I see the following
I'm not sure what to do now so if someone could help me fix this it would be greatly appreciated
Hi, this seems like a very cool project! Do you think it would be possible to add MapLibre support as well? MapLibre is an open source fork of the sadly-no-longer-open-but-still-loved MapBox code. Thanks!
https://docs.mapbox.com/mapbox-gl-js/api/map/#map#on
map.on('click', 'countries', (e) => {
new mapboxgl.Popup()
.setLngLat(e.lngLat)
.setHTML(`Country name: ${e.features[0].properties.name}`)
.addTo(map);
});
Add Rust binding to FullscreenControl
This issue depends on #33
Add Rust binding to ScaleControl
This issue depends on #33
When using mapboxgl
inside of a Yew app, it would be helpful to pass around MapFactory
or Map
as props to other components so they can manipulate the map in different ways. Yew requires that props implement Properties
and PartialEq
.
Additionally, in order to take a map instance and pass it into a Yew context provider like use_context
, the type must implement ParitalEq
(docs for use_context).
Global state management crates for Yew like bounce also require that the shared value be ParitalEq
.
This will allow the mapbox gl instance to be used outside of the context where it was initialized.
Add Rust binding to these
This project is open to accept contributions to enable support for using heatmaps ? It is not included on this roadmap but is quite useful.
The requirements for heatmaps would be to extend the Paint structure to allow some additional properties that could me set by default as none to not affect the existing base of dependent crates.
I'm glad to build the necessary wasm-bindgen but I need the confirmation that there is interest to send the pull request
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.