### Run Web Example Source: https://github.com/maximkaaa/galileo/blob/main/README.md Command to run a web example using the Galileo project. Requires 'wasm_pack', 'just', and 'python3' to be installed. ```shell just run_web_example ``` -------------------------------- ### Run All Simple Examples Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md This command allows you to run all the simple examples provided within the project. Replace `` with the specific name of the example you wish to execute. ```shell cargo run --example ``` -------------------------------- ### Egui Integration Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md This example is similar to the raster tiles example but adds support for the egui graphical user interface library. ```rust // Same as the raster tiles example, but with support for [egui](https://www.egui.rs/). ``` -------------------------------- ### Highlight Features Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Demonstrates how to get and update features when the cursor hovers over them, and how to display different pin images based on the feature's state. ```rust // Get and update features on cursor hover // Show a different pin image based on feature state ``` -------------------------------- ### Render to File Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md This example demonstrates running a map application without a visible window. It covers loading a GEOJSON file into a feature layer and rendering the map output to a PNG file. ```rust // Run a map without a window // Load GEOJSON file to a feature layer // Render the map to a .png file ``` -------------------------------- ### GeoRust Integration Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Illustrates loading features using `geo-types` geometries via the `geo-zero` crate and displaying these features with pin images. ```rust // Load features as `geo-types` geometries using `geo-zero` crate // Display the features with pin images ``` -------------------------------- ### Vector Tiles Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md This example shows how to create a map using vector tiles from MapLibre. It includes configuring layer styling via a style file and retrieving information about tile objects on click. ```rust // Create a map with one vector tile layer (MapLibre) // Configure layer styling with the style file // Get information about objects in the tiles by click ``` -------------------------------- ### Lambert Projection Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md This example focuses on rendering a feature layer using the Lambert Equal Area projection. It also demonstrates how to retrieve and update features when the cursor hovers over them. ```rust // Render feature layer in Lambert Equal Area projection // Get and update features on cursor hover ``` -------------------------------- ### Raster Tiles Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Demonstrates how to create a map with a single raster tile layer, specifically OpenStreetMap (OSM). It also shows how to set the initial position and zoom level of the map. ```rust // Create a map with one raster tile layer (OSM) // Set initial map position and zoom ``` -------------------------------- ### LineString Rendering Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Shows how to render a `LineString` defined in a GeoJSON `FeatureCollection` as a `Contour` within a `FeatureLayer`. This is analogous to the MapLibre GL JS example 'Add a GeoJSON line'. ```rust // Renders a `LineString` defined in a geojson `FeatureCollection` as a `Contour` in a `FeatureLayer`. Very similar to // MapLibre GL example ['Add a GeoJSON line'](https://maplibre.org/maplibre-gl-js/docs/examples/add-a-geojson-line/) ``` -------------------------------- ### Feature Layers Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Illustrates creating a map with feature layers without a base tile map. It covers advanced styling using symbols based on feature properties, modifying feature display on hover, handling click events for feature information, and toggling feature visibility. ```rust // Create a map with feature layers without a tile base map // Use symbols to set advanced styles for features based on their properties // Change properties of the features when hovering mouse over them // Modify how the features are displayed based on changed properties // Get information about features by click // Hide/show features by clicking on them ``` -------------------------------- ### Many Points Rendering Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Demonstrates the performance capabilities of the renderer by displaying approximately 3,000,000 3D points overlaid on a map. ```rust // Render ~3_000_000 3D points over a map ``` -------------------------------- ### LAS Data Rendering Example Source: https://github.com/maximkaaa/galileo/blob/main/galileo/examples/README.md Shows how to read a large LAS dataset (approximately 19,000,000 points) and render all points without pre-grouping to test renderer performance limits. It requires loading the dataset separately and is recommended to be run in release mode. ```rust // Read ~19_000_000 points from a LAS data set (lidar laser scanning result) // Render all the points without pre-grouping (to demonstrate renderer performance limits) // NOTE: before running the example, load the dataset. Read module-level docs in the example file. // NOTE 2: You probably want to run this example in --release mode ``` -------------------------------- ### Cross-compile Rust to Windows Source: https://github.com/maximkaaa/galileo/blob/main/README.md Steps to cross-compile Rust code from Linux to Windows using the GNU toolchain. This involves adding the target and installing a cross-linker. ```shell rustup target add x86_64-pc-windows-gnu sudo apt-get install mingw-w64 cargo build --target x86_64-pc-windows-gnu ``` -------------------------------- ### Build Galileo Map Rust App for Android Source: https://github.com/maximkaaa/galileo/blob/main/android_examples/raster_tiles/README.md This snippet shows the shell commands required to build the Galileo map Rust application for Android. It covers installing Cargo NDK, adding Android toolchains, setting the NDK environment variable, and finally executing the build command for multiple architectures. ```shell cargo install cargo-ndk rustup target add \ aarch64-linux-android \ armv7-linux-androideabi \ x86_64-linux-android \ i686-linux-android export ANDROID_NDK_HOME=~/Android/Sdk/ndk/26.1.10909125/ cargo ndk -t arm64-v8a -t armeabi-v7a -t x86 -t x86_64 -o ../app/src/main/jniLibs/ build ``` -------------------------------- ### JavaScript for WASM Initialization and Event Handling Source: https://github.com/maximkaaa/galileo/blob/main/web-example/index.html This JavaScript code initializes the WebAssembly module using `wasm_bindgen` and calls the `main` function. It also includes an event listener to prevent the default context menu behavior on the page. ```javascript const {main} = wasm_bindgen; async function run_wasm() { console.log("Starting bindgen"); await wasm_bindgen(); main(); console.log("WASM loaded"); } console.log("Running wasm"); run_wasm(); document.addEventListener('contextmenu', event => event.preventDefault()); ``` -------------------------------- ### Contribution Pre-check Source: https://github.com/maximkaaa/galileo/blob/main/README.md Command to ensure code quality and CI compatibility before pushing changes. Requires 'wasm32' target, Rust nightly, and 'typos-cli'. ```shell just check ``` -------------------------------- ### HTML and CSS for Web Page Layout and Styling Source: https://github.com/maximkaaa/galileo/blob/main/web-example/index.html This snippet includes CSS rules for basic HTML structure, touch event handling, background colors for light and dark modes, and canvas element styling to fill the entire viewport. It also defines styles for a centered text element and a CSS loading animation. ```css html, body { overflow: hidden; margin: 0 !important; padding: 0 !important; height: 100%; width: 100%; } /* Simple map html */ html { /* Remove touch delay: */ touch-action: manipulation; } body { /* Light mode background color for what is not covered by the egui canvas, or where the egui canvas is translucent. */ background: #909090; } @media (prefers-color-scheme: dark) { body { /* Dark mode background color for what is not covered by the egui canvas, or where the egui canvas is translucent. */ background: #404040; } } /* Allow canvas to fill entire web page: */ canvas { margin-right: auto; margin-left: auto; display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .centered { margin-right: auto; margin-left: auto; display: block; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #f0f0f0; font-size: 24px; font-family: Ubuntu-Light, Helvetica, sans-serif; text-align: center; } /* ---------------------------------------------- */ /* Loading animation from https://loading.io/css/ */ .lds-dual-ring { display: inline-block; width: 24px; height: 24px; } .lds-dual-ring:after { content: " "; display: block; width: 24px; height: 24px; margin: 0px; border-radius: 50%; border: 3px solid #fff; border-color: #fff transparent #fff transparent; animation: lds-dual-ring 1.2s linear infinite; } @keyframes lds-dual-ring { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } ``` -------------------------------- ### Galileo API Documentation Source: https://github.com/maximkaaa/galileo/blob/main/README.md This section outlines the core API components of the Galileo library, including the Map, Layer, and Renderer. It details their functionalities, supported data sources, styling capabilities, and rendering features. ```APIDOC Map: - Core component for managing map layers and rendering. - Supports different modes of use (client, server, CLI). - Handles caching and projection logic. Layer: - Represents different types of map data (raster tiles, vector tiles, feature layers). - Supports styling for visual representation. - Handles data loading and transformation. Renderer: - Responsible for drawing map data to the screen. - Utilizes wgpu backend for cross-platform rendering. - Supports various projections and tile schemes. Supported Data Sources: - TMS tiles - 2D geometries - MVT (Mapbox Vector Tiles) Supported Features: - Raster tile layers - Vector tile layers with styling - Vector geo-data layers (feature layers) with styling - 3D view and 3D object rendering - User-input handling (mouse, touch WIP) - Support for different projections and tile schemes - High performance rendering Roadmap: - v0.1 (Usability): Architecture, styling, main source types, projections. - v0.2 (Beautification): Basic and advanced styling. - v0.3 (3D-fication): 3D globe, terrain, models, advanced projections. - v0.4 (Beta): Stabilize API, GIS standards (PostGIS, WMS, WFS), more styling (clusters, heatmaps), custom shaders. - v0.5 (Beta): Stabilize API for features/projections, UI framework interoperability, FFI bindings. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.