Giter Site home page Giter Site logo

mapbox-gl-rs's Introduction

mapbox-gl-rs's People

Contributors

dependabot[bot] avatar gregoryraymond avatar griffobeid avatar jryio avatar shimatar0 avatar wa1aric avatar yukinarit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

mapbox-gl-rs's Issues

Implement PartialEq for Map or MapFactory

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.

The requested module './snippets/mapboxgl-89106e6563064742/mapbox-gl.js' does not provide an export named 'Map'

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

image

And when I open bundle.js in the dev tools I see the following

image

I'm not sure what to do now so if someone could help me fix this it would be greatly appreciated

Heatmaps

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

MapLibre support?

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!

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.