Integrate browser geolocation API (#9)

* Add GPS service and nautical base city data

- Implement `GpsService` with methods for position updates and enabling/disabling GPS.
- Introduce test data for nautical base cities with key attributes like population, coordinates, and images.
- Update dependencies in `bun.lock` with required packages such as `geojson`.

* give map a custom style

* shift towards rust exclusivity

* `build.rs` streamlines map build. Added an axum server with the map assets embedded.

* update readmes

* base-map api retrieves geolocation from the navigator of the browser

* make map standalone wry that pulls assets from the server to simulate behavior in bevy

* wip wasm

* wasm build fixed

* fix path ref to assets

---------

Co-authored-by: geoffsee <>
This commit is contained in:
Geoff Seemueller
2025-07-16 17:44:25 -04:00
committed by GitHub
parent 4b3dd2a1c3
commit 602bc5d4b8
49 changed files with 7748 additions and 1279 deletions

View File

@@ -0,0 +1,93 @@
[package]
name = "base-map"
version = "0.1.0"
edition = "2021"
description = "Rust backend + Vite frontend"
license = "MIT OR Apache-2.0"
# Tell Cargo to run our build script
build = "build.rs"
# ────────────────────────────────────────────────
# Dependencies you actually need in Rust code
# (pick only the ones you want)
# ────────────────────────────────────────────────
[dependencies]
# Web server framework (swap for actixweb, warp, etc.)
axum = { version = "0.7", optional = true, default-features = false, features = ["macros", "tokio", "http1", "json"] }
tokio = { version = "1.46.0", features = ["full"], optional = true}
tower-http = { version = "0.6", features = ["full"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
anyhow = "1"
axum-embed = "0.1.0"
wry = { version = "=0.51.2", features = ["protocol", "os-webview"] }
tao = { version = "0.34"}
web-sys = { version = "0.3.77", features = [
"console",
"Geolocation",
"Navigator",
"Window",
"Document",
"Element",
"Position",
"PositionOptions",
"PositionError",
"Coordinates"
] }
# Staticfile embedding helper (compile assets straight into the binary).
# If you prefer reading from disk at runtime, delete this.
rust-embed = { version = "8", optional = true }
serde = { version = "1.0.219", features = ["derive"] }
# ────────────────────────────────────────────────
# Devonly dependencies (examples, tests, benches)
# ────────────────────────────────────────────────
[dev-dependencies]
serde_json = "1"
# ────────────────────────────────────────────────
# Features let you strip out things you dont want
# by disabling default features in your workspace
# ────────────────────────────────────────────────
[features]
default = ["server", "embed-assets"]
# Feature that pulls in the server stack
server = ["axum", "tokio"]
# Feature that embeds Vites dist/ into the binary
embed-assets = ["rust-embed"]
# ────────────────────────────────────────────────
# Tell Cargo what NOT to publish to crates.io
# ────────────────────────────────────────────────
[package.metadata]
# Keep your node_modules and dist/ out of the crate
# published to crates.io (theyre huge and useless there)
exclude = [
"map/node_modules/**",
"map/dist/**"
]
# ────────────────────────────────────────────────
# Optional: workspace setup
# ────────────────────────────────────────────────
# If this lives inside a workspace, remove [workspace] here
# and put these paths in the root Cargo.toml instead.
[lib]
# Default name is fine; no need to set anything unless you want cdylib, etc.
path = "src/lib.rs"
# Optional: multiple binaries live in src/bin/
[[bin]]
name = "server" # produces target/release/server
path = "src/main.rs"
# Optional: multiple binaries live in src/bin/
[[bin]]
name = "app" # produces target/release/server
path = "src/app.rs"