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

Import new maps on web #1014

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Import new maps on web #1014

wants to merge 10 commits into from

Conversation

dabreegster
Copy link
Collaborator

Importing new areas works only on the native version today. For #1009 and other reasons, it could be nice to do this on the web too, even though it'd be slow and someone would have to re-import the map every single session, even when switching apps.

The complication is that we can't just include the extra dependencies in all of the app executables; it would increase initial loading time, even for the common case of only using pre-imported maps. On native, we split out a cli binary and call it as a subprocess. The approach in this PR is the same -- we can dynamically load a JS+WASM module and bring in the extra dependencies.

This PR is a draft because it's still not working. The two big problems:

  1. When I try to turn a Map into bincoded bytes to pass back to JS, it freezes and I can't figure out why. For some reason, serializing a RawMap works fine, so we could do the RawMap->Map step back in map_gui without needing extra dependencies. But bizarrely, deserializing breaks. The number of bytes passed back is the same, but the actual bytes themselves seem to change. Is it somehow an endianness or 32/64-bit issue, even though both ends are using wasm32?

  2. Reading the clipboard contents for the GeoJSON boundary isn't obvious. The WASM support for it requires some experimental flag, and it's async. I found https://docs.rs/quad-wasmnastics/latest/quad_wasmnastics/ as possible reference.

Many other cleanups still needed, but first I just want to get this working

... slightly stuck at the clipboard step
IT WORKS. getting overpass xml data back now!
... hitting the wasm env but though. I recognize you!
and try to load the received map

we seem stuck after preparing the CH?
byte len matches, but then serde deserialize breaks.
Invalid size 7310312400223103264: sizes must fit in a usize (0 to
4294967295)
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 this pull request may close these issues.

1 participant