### Install and Build Baremaps Renderer Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/README.md These commands install required Node.js dependencies, build the Baremaps Renderer project, and then link the executable to the system's path, allowing it to be used as a command-line tool globally. ```bash npm install npm run build npm link ``` -------------------------------- ### Network and Organization Object Definition Examples Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-testing/data/rpsl/sample.txt A comprehensive collection of example network and organization object definitions. These examples showcase various field combinations, including different IP range formats (CIDR and start-end), country codes, geographical coordinates, and organizational details. Each entry includes a 'note' field explaining its specific purpose or expected behavior, such as indexing with 'WORLD' precision for entries without country codes, or testing with maximum byte values. ```Configuration Data inetnum: 0.0.0.0 - 0.0.0.255 netname: Route de Cheseaux 1 descr: Route de Cheseaux 1 descr: Vaud descr: Suisse country: CH note: The most simple entry inetnum: 0.0.0.0 - 0.0.0.255 netname: anetwork in Yverdon country: CH note: Object with country and netname should be searched by fields inetnum: 0.0.0.0 - 0.0.0.255 netname: Route de Cheseaux 1 descr: Route de Cheseaux 1 descr: Vaud descr: Suisse country: LI note: Test with wrong country code should not be indexed, test data geocoder do no contain LI entries inetnum: 0.0.0.0 - 0.0.0.255 netname: Route de Cheseaux 1 descr: Route de Cheseaux 1 descr: Vaud descr: Suisse note: Entry without the country code are indexed with WORLD precision inetnum: 0.0.0.0/24 netname: Route de Cheseaux 1 descr: Route de Cheseaux 1 descr: Vaud descr: Suisse country: CH note: Simple test with a mask instead of ip range inetnum: 255.0.0.1 - 255.255.255.255 netname: Route de Cheseaux 1 descr: Route de Cheseaux 1 descr: Vaud descr: Suisse country: CH note: Test with values that have the maximum byte value inetnum: 0.0.0.3 - 0.0.0.10 netname: Geoloc geoloc: 43.12 9.422212222 note: Test with a geoloc inetnum: 0.0.0.11 - 0.0.0.20 netname: Suisse country: CH note: Test with country code only organisation: ORG-VDN2-RIPE org-name: Organisation test org-type: OTHER address: Dummy address for ORG-VDN2-RIPE note: Test with a not found address inet6num: 2001:7fa:0:2::/64 netname: Ipv6 descr: 6KANet(IPv6 Korea Advanced Network) descr: IPv6 Internet eXchange Point descr: 168, Jukjon-Ri, Suji-Eub, Yongin-Si, Gyonggi-Do, descr: S. Korea 449-717 note: IPV6 test ``` -------------------------------- ### Get Baremaps Renderer Command-Line Help Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/README.md This command displays a list of all available commands and options for the Baremaps Renderer command-line interface, providing guidance on its usage. ```bash baremaps-renderer --help ``` -------------------------------- ### Run Integration Tests for Baremaps Source: https://github.com/apache/incubator-baremaps/blob/main/CONTRIBUTING.md Command to execute integration tests for the Baremaps project using Maven. This requires a local and properly configured PostgreSQL installation to run successfully. ```bash mvn install -P integration ``` -------------------------------- ### Basic HTML Element Styling for Geocoder Example Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/geocoder/index.html Provides basic CSS styling for the form, table, table cells, and table headers to improve readability and layout of the geocoder example page. ```CSS form { margin-bottom: 1rem; } td, th { padding: 1rem; border: 1px solid black; } table { border-collapse: collapse; } ``` -------------------------------- ### Start Baremaps Development Server for Map Tiles and Style Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/README.md This command starts the Baremaps development server, enabling automatic reloading of the map when configuration files are modified. It's useful for development and testing, serving vector tiles from 'tileset.js' and applying styles from 'style.js'. ```Shell baremaps map dev --log-level DEBUG \ --tileset 'tileset.js' \ --style 'style.js' ``` -------------------------------- ### Baremaps TileJSON Configuration Example for Vector Layers Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/README.md This example demonstrates the TileJSON configuration format used in `tileset.js` for Baremaps. It defines a vector layer with a specific ID and includes SQL queries to extract data for different zoom levels, extending the TileJSON specification with PostGIS dialect queries. ```JSON { "tilejson": "2.2.0", "tiles": [ "http://localhost:9000/tiles/{z}/{x}/{y}.mvt" ], "vector_layers": [ { "id": "aerialway", "queries": [ { "minzoom": 14, "maxzoom": 20, "sql": "SELECT id, tags, geom FROM osm_way_z${zoom} WHERE tags ? 'aerialway'" } ] } ] } ``` -------------------------------- ### Initialize MapLibre GL JS Map with RTL Plugin and Interactive Controls Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/static/server.html This JavaScript code initializes a MapLibre GL JS map, including a check and load for the RTL text plugin if needed. It then adds essential interactive controls such as `NavigationControl`, `MaplibreInspect` (with popup configuration), and `MaplibreTileBoundaries` to enhance user interaction and debugging capabilities on the map. ```JavaScript // Load the right-to-left plugin if necessary. if (maplibregl.getRTLTextPluginStatus() === 'unavailable') { maplibregl.setRTLTextPlugin( 'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js', null, true ); } // Initialize the map let map = new maplibregl.Map({ container: 'map', style: '/style.json', hash: true }); // Add the navigation control to the map map.addControl(new maplibregl.NavigationControl()); // Add the inspect control to the map map.addControl(new MaplibreInspect({ showMapPopup: true, showMapPopupOnHover: false, showInspectMapPopupOnHover: false, popup: new maplibregl.Popup({ closeButton: true, closeOnClick: true, maxWidth: 'none' }) })); // Add the tile boundaries control to the map map.addControl(new MaplibreTileBoundaries({ showBoundaries: false })); ``` -------------------------------- ### CSS Styling for IP Geolocation Form and Results Table Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/iploc/index.html Defines basic CSS styles for the IP geolocation form and the results table. It sets margins, padding, borders, and collapses table borders for a clean display. ```css form { margin-bottom: 1rem; } td, th { padding: 1rem; border: 1px solid black; } table { border-collapse: collapse; } ``` -------------------------------- ### Configure Full-Screen Map Container with CSS Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/static/server.html This CSS snippet sets the `body` margin to zero and configures the `#map` element to occupy the entire viewport. It ensures the map is fixed and spans 100% of the width and height, providing a full-screen mapping experience. ```CSS body { margin: 0; } #map { position: fixed; width: 100%; height: 100%; } ``` -------------------------------- ### JavaScript Geocoder Search and Table Population Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/geocoder/index.html Implements client-side JavaScript to handle form submission, fetch geocoding results from the Baremaps API, and dynamically populate an HTML table with the returned data. It extracts headers from the first result and iterates through all results to display scores and data fields. ```JavaScript // Add a listener to submit the search form const searchForm = document.getElementById('searchForm'); searchForm.addEventListener('submit', search); // Get the table of results const table = document.getElementById('results'); function search(event) { event.preventDefault(); // Build the query string const formData = new FormData(searchForm); const queryString = new URLSearchParams(formData).toString() // Send the search request fetch(`${window.location.origin}/api/geocoder?${queryString}`) .then(response => response.json()) .then(response => { // Extract the headers from the first row const headers = response.results && response.results.length > 0 ? Object.keys(response.results[0].data).sort() : []; // Clear the results table table.innerHTML = ''; // Insert the headers in the table const headerRow = table.insertRow(); headerRow.innerHTML = `#score${headers.map(header => `${header}`).join('')}`; // Insert the results in the table response.results.forEach((result, index) => { const row = table.insertRow(); row.insertCell().innerText = index; row.insertCell().innerText = result.score; headers.forEach(header => { if (result.data[header] !== undefined) { row.insertCell().innerText = result.data[header]; } else { row.insertCell().innerText = ''; } }); }); }) .catch(error => console.error(error)); } ``` -------------------------------- ### JavaScript Function to Query IP Geolocation API Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/iploc/index.html This JavaScript function, `searchByIp`, handles the submission of an IP address. It sends an XMLHttpRequest to the local Baremaps IP geolocation API, parses the JSON response, and dynamically populates an HTML table with detailed geolocation information such as IP range, coordinates, network, and country. ```javascript function searchByIp(event) { event.preventDefault(); // Get the IP address from the form var ip = document.getElementById('ip').value; // Make a http request on localhost:9100/api/ip/:ip to retrieve the IP address const request = new XMLHttpRequest(); request.open('GET', `http://localhost:9000/api/iploc?ip=${ip}`, true); // Set request Accept header to application/json request.setRequestHeader('Accept', 'application/json'); // Display the request result in the map request.onload = function () { if (request.status >= 200 && request.status < 400) { // Success! const geoLocations = JSON.parse(request.responseText); // Fill the table of geo locations from the resulting geoLocations // Geo locations contain an address, an ipv4Range, a location, a network and a country const table = document.getElementById('results'); table.innerHTML = ''; // Insert header row table.insertRow().innerHTML = '#GeocoderInputIP RangeLongitudeLatitudeNetworkCountrySourcePrecision'; for (let i = 0; i < geoLocations.length; i++) { const row = table.insertRow(i + 1); let pos = 0; let cell = row.insertCell(pos++); cell.innerHTML = i + 1; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].geocoderInput; cell = row.insertCell(pos++); cell.innerHTML = `${geoLocations[i].inetStart} - ${geoLocations[i].inetEnd}`; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].longitude; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].latitude; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].network; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].country; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].source; cell = row.insertCell(pos++); cell.innerHTML = geoLocations[i].precision; } } else { // We reached our target server, but it returned an error console.log('Error'); } }; request.send(); } ``` -------------------------------- ### Basic CSS for Full-Page Map Layout Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/dem/index.html This CSS snippet ensures the HTML body and a map container element (`#map`) occupy the full height and width of the viewport, removing default margins and padding. This is a common setup for full-screen map applications. ```CSS body { margin: 0; padding: 0; } html, body, #map { height: 100%; } ``` -------------------------------- ### Clone and Build Baremaps Project Source: https://github.com/apache/incubator-baremaps/blob/main/CONTRIBUTING.md Instructions to clone the Baremaps Git repository and build the project using Maven. This command sequence sets up the local development environment for Baremaps. ```bash git clone git@github.com:baremaps/baremaps.git cd baremaps/ mvn install ``` -------------------------------- ### Reproduce Apache Baremaps Build with Docker Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md This snippet demonstrates how to reproduce a specific Apache Baremaps release build using Docker and Maven. It checks out a release candidate version and runs a clean verify with artifact comparison against the Apache staging repository in a clean JDK 17 environment. ```bash git checkout v$RELEASE_VERSION-rc$CANDIDATE_NUMBER docker run \ -v $(pwd):/baremaps \ -w /baremaps \ eclipse-temurin:17-jdk \ ./mvnw clean verify -DskipTests artifact:compare -Dreference.repo=https://repository.apache.org/content/repositories/staging/ ``` -------------------------------- ### Copy Apache Baremaps Release Artifacts to Distribution Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Utilize SVN to copy the approved release artifacts from the Apache development directory to the official release directory. This makes the final release binaries publicly accessible for download. ```bash svn cp https://dist.apache.org/repos/dist/dev/incubator/baremaps/$RELEASE_VERSION-rc$CANDIDATE_NUMBER https://dist.apache.org/repos/dist/release/incubator/baremaps/$RELEASE_VERSION -m "Release Apache Baremaps (incubating) $RELEASE_VERSION" ``` -------------------------------- ### Run Baremaps Renderer Integration Tests Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/README.md This command executes the integration tests located in a 'tests' folder, using a specified style URL. After execution, a report is generated in 'tests/report.html'. ```bash baremaps-renderer run -s ``` -------------------------------- ### Deploy Apache Baremaps Next Iteration Artifacts Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Perform a clean build and deploy of the project's artifacts. This command ensures that the latest snapshot of the project is compiled and deployed, typically to a local or remote Maven snapshot repository, for ongoing development. ```bash ./mvnw clean deploy ``` -------------------------------- ### Create Apache Baremaps Release Branch Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Navigate into the `baremaps` project directory. Then, create a new Git branch named `release-$RELEASE_VERSION` to isolate release-specific changes and prepare for the version finalization. ```bash cd baremaps git checkout -b release-$RELEASE_VERSION ``` -------------------------------- ### Publish Apache Baremaps Release to Maven Repository Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Execute a Maven `clean deploy` command with the `apache-release` profile activated. This action publishes the compiled release artifacts, including JARs and POMs, to the configured Maven repository, making them available for dependency management. ```bash ./mvnw clean deploy -Papache-release ``` -------------------------------- ### Initialize Baremaps Database Schema and Import Data Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/README.md These commands are used to initialize a new Baremaps database. The first command creates the necessary database schema, the second imports OpenStreetMap data, and the third refreshes materialized views for optimal performance. ```Shell baremaps workflow execute --file create.js baremaps workflow execute --file import.js baremaps workflow execute --file refresh.js ``` -------------------------------- ### Push Apache Baremaps Release Candidate Tag Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Push the newly created release candidate tag to the remote Git repository. This action triggers automated GitHub Actions, which build the candidate, publish artifacts to a development directory, and draft a release on GitHub. ```bash git push origin v$RELEASE_VERSION-rc$CANDIDATE_NUMBER ``` -------------------------------- ### Tag Apache Baremaps Release Candidate Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Create a lightweight Git tag for the current commit, marking it as a release candidate. The tag format `v$RELEASE_VERSION-rc$CANDIDATE_NUMBER` helps identify specific candidate iterations for review. ```bash git tag v$RELEASE_VERSION-rc$CANDIDATE_NUMBER ``` -------------------------------- ### Generate Apache Baremaps Release Announcement Email Template Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md This snippet provides a bash command to generate the standard email template for announcing an Apache Baremaps release. It includes placeholders for the release version and release manager name, along with links to release notes, artifacts, repository, documentation, mailing list, and issue tracker. ```bash cat << EOF subject: [ANNOUNCE] Apache Baremaps $RELEASE_VERSION (incubating) released Hello Everyone, The Apache Baremaps community is pleased to announce the release of Apache Baremaps $RELEASE_VERSION (incubating). Apache Baremaps is a toolkit and a set of infrastructure components for creating, publishing, and operating online maps. The release notes are available here: https://github.com/apache/incubator-baremaps/releases/tag/v$RELEASE_VERSION The artifacts are available here: https://dist.apache.org/repos/dist/release/incubator/baremaps/$RELEASE_VERSION We are looking to grow our community and welcome new contributors. If you are interested in contributing to the project, please contact us on the mailing list or on GitHub. We will be happy to help you get started. The repository is available here: https://github.com/apache/incubator-baremaps The documentation is available here: https://baremaps.apache.org The mailing list is available here: https://lists.apache.org/list.html?dev@baremaps.apache.org The issue tracker is available here: https://github.com/apache/incubator-baremaps/issues Best regards, $RELEASE_MANAGER_NAME EOF ``` -------------------------------- ### Verify Apache Baremaps Release Artifact GPG Signature Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md This snippet shows how to verify the GPG signatures of the binary and source release artifacts for Apache Baremaps, ensuring their authenticity. ```bash gpg --verify apache-baremaps-$RELEASE_VERSION-incubating-bin.tar.gz.asc gpg --verify apache-baremaps-$RELEASE_VERSION-incubating-src.tar.gz.asc ``` -------------------------------- ### View Baremaps Renderer Test Report Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/README.md This command opens the generated test report in 'tests/report.html' directly in the default web browser, providing a convenient way to review test results. ```bash baremaps-renderer report --open ``` -------------------------------- ### MapLibre GL JS Map Initialization with Controls and Split View Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/static/viewer.html This JavaScript snippet initializes two MapLibre GL JS maps (one vector, one raster), loads the RTL text plugin if needed, adds various interactive controls (FrameRateControl, NavigationControl, MaplibreInspect, MaplibreTileBoundaries, MaplibreMapSplitViewToggle), and sets up synchronization between the vector and raster maps. It also includes an EventSource listener for live style updates. ```javascript // Load the right-to-left plugin if necessary. if (maplibregl.getRTLTextPluginStatus() === 'unavailable') { maplibregl.setRTLTextPlugin( 'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js', null, true ); } // Initialize the map let map = new maplibregl.Map({ container: 'map', style: '/style.json', hash: true }); // Split view the vector map with the osm raster map const osmMap = new maplibregl.Map({ container: 'osmMap', style: { 'version': 8, 'sources': { 'raster-tiles': { 'type': 'raster', 'tiles': [ 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' ], 'tileSize': 256, 'attribution': '© OpenStreetMap' } }, 'layers': [ { 'id': 'simple-tiles', 'type': 'raster', 'source': 'raster-tiles', 'minzoom': 0, 'maxzoom': 22 } ] }, center: map.getCenter(), zoom: map.getZoom(), bearing: map.getBearing(), hash: false, interactive: false, }); // Add the framerate control to the map const fps = new maplibregl.FrameRateControl(); map.addControl(fps); // Add the navigation control to the map map.addControl(new maplibregl.NavigationControl()); // Add the inspect control to the map map.addControl(new MaplibreInspect({ showMapPopup: true, showMapPopupOnHover: false, showInspectMapPopupOnHover: false, popup: new maplibregl.Popup({ closeButton: true, closeOnClick: true, maxWidth: 'none' }) })); // Add the tile boundaries control to the map map.addControl(new MaplibreTileBoundaries({ showBoundaries: false })); // Add the split view toggle to the map map.addControl(new MaplibreMapSplitViewToggle({ splitMap: osmMap, splitMapContainerId: 'osmMapWrapper', })); // Sync the vector tile map with the raster tile map map.on('move', () => { if (document.getElementById('osmMapWrapper').getAttribute('data-state') === 'visible') { osmMap.jumpTo({ center: map.getCenter(), zoom: map.getZoom(), bearing: map.getBearing(), pitch: map.getPitch() }); } }); // Listen to configuration changes and update the map const connection = new EventSource('/changes') connection.onmessage = e => { let style = JSON.parse(e.data); if (style.reload) { location.reload(); } delete style.reload; map.setStyle(style); } ``` -------------------------------- ### Generate Apache Baremaps Release Vote Email Template Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md This snippet provides a bash command to generate the standard email template for initiating a release vote for Apache Baremaps. It includes placeholders for release version, candidate number, commit hash, and release manager name, along with links to release notes, commit, artifacts, and keys. ```bash cat << EOF subject: [VOTE] Release Apache Baremaps $RELEASE_VERSION-rc$CANDIDATE_NUMBER (incubating) Hello Everyone, I have created a build for Apache Baremaps (incubating) $RELEASE_VERSION, release candidate $CANDIDATE_NUMBER. Thanks to everyone who has contributed to this release. You can read the release notes here: https://github.com/apache/incubator-baremaps/releases/tag/v$RELEASE_VERSION-rc$CANDIDATE_NUMBER The commit to be voted upon: https://github.com/apache/incubator-baremaps/tree/v$RELEASE_VERSION-rc$CANDIDATE_NUMBER Its hash is $COMMIT_HASH. Its tag is v$RELEASE_VERSION-rc$CANDIDATE_NUMBER. The artifacts to be voted on are located here: https://dist.apache.org/repos/dist/dev/incubator/baremaps/$RELEASE_VERSION-rc$CANDIDATE_NUMBER/ The hashes of the artifacts are as follows: Release artifacts are signed with the following key: http://people.apache.org/keys/committer/.asc https://downloads.apache.org/incubator/baremaps/KEYS The README file for the src distribution contains instructions for building and testing the release. Please vote on releasing this package as Apache Baremaps $RELEASE_VERSION. The vote is open for the next 72 hours and passes if a majority of at least three +1 PMC votes are cast. [ ] +1 Release this package as Apache Baremaps $RELEASE_VERSION [ ] 0 I don't feel strongly about it, but I'm okay with the release [ ] -1 Do not release this package because... Here is my vote: +1 (binding) $RELEASE_MANAGER_NAME EOF ``` -------------------------------- ### Run Unit Tests for Baremaps Source: https://github.com/apache/incubator-baremaps/blob/main/CONTRIBUTING.md Command to execute all unit tests within the Baremaps project using Maven. This ensures that local changes do not break existing functionality. ```bash mvn test ``` -------------------------------- ### Verify Apache Baremaps Release Artifact SHA512 Checksum Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md This snippet demonstrates how to verify the SHA512 checksums of the binary and source release artifacts for Apache Baremaps, ensuring their integrity. ```bash shasum -a 512 -c apache-baremaps-$RELEASE_VERSION-incubating-bin.tar.gz.sha512 shasum -a 512 -c apache-baremaps-$RELEASE_VERSION-incubating-src.tar.gz.sha512 ``` -------------------------------- ### Set Apache Baremaps Next Development Version Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Update the project's version to the next development snapshot using Maven, ensuring no backup POMs are generated. Commit this version change with a message indicating preparation for the next iteration and push it to the origin. ```bash ./mvnw versions:set -DnewVersion=$NEXT_VERSION-SNAPSHOT -DgenerateBackupPoms=false git commit -a -m "Prepare for next development iteration" git push origin ``` -------------------------------- ### Define Baremaps Application Properties Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/version.txt This snippet defines core properties for the Baremaps application, setting its name to 'Baremaps' and its version dynamically from a project variable. This is typically found in configuration files or build scripts. ```Properties application=Baremaps version=${project.version} ``` -------------------------------- ### Tag and Push Approved Apache Baremaps Release Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md If the release candidate is approved, create an annotated Git tag for the final release version. Pushing this tag to the remote repository triggers the same GitHub Actions as the release candidate, finalizing the official release. ```bash git tag -a v$RELEASE_VERSION git push origin v$RELEASE_VERSION ``` -------------------------------- ### Set Apache Baremaps Release Environment Variables Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Define essential environment variables like `RELEASE_VERSION`, `NEXT_VERSION`, `CANDIDATE_NUMBER`, `RELEASE_MANAGER_NAME`, and `COMMIT_HASH`. These variables are crucial for automating and standardizing the release process across various commands. ```bash export RELEASE_VERSION= # e.g. 0.7.1 export NEXT_VERSION= # e.g. 0.7.2 export CANDIDATE_NUMBER= # e.g. 1 export RELEASE_MANAGER_NAME= # e.g. John Doe export COMMIT_HASH= # e.g. 1234567890 ``` -------------------------------- ### Run Apache Rat Compliance Check Source: https://github.com/apache/incubator-baremaps/blob/main/CONTRIBUTING.md Executes Apache Rat to verify compliance with the ASF Source Header and Copyright Notice Policy. A textual report is generated in `target/rat.txt`. It is required to run `mvn clean` separately before `mvn apache-rat:check` because the parent module scans submodule files. The project is currently in progress of reaching full compliance, so contributors should focus on checking newly added content in the report. ```Shell mvn clean && mvn apache-rat:check ``` -------------------------------- ### Initialize MapLibre GL JS Map with Controls and RTL Plugin Source: https://github.com/apache/incubator-baremaps/blob/main/examples/openstreetmap/index.html This JavaScript code initializes a MapLibre GL JS map, checks for and loads the right-to-left text plugin if needed, and adds navigation, inspection, and tile boundaries controls to the map. The map is configured to use a specific style and hash for URL state. ```JavaScript // Load the right-to-left plugin if necessary. if (maplibregl.getRTLTextPluginStatus() === 'unavailable') { maplibregl.setRTLTextPlugin( 'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js', null, true ); } // Initialize the map let map = new maplibregl.Map({ container: 'map', style: '/style.json', hash: true }); // Add the navigation control to the map map.addControl(new maplibregl.NavigationControl()); // Add the inspect control to the map map.addControl(new MaplibreInspect({ showMapPopup: true, showMapPopupOnHover: false, showInspectMapPopupOnHover: false, popup: new maplibregl.Popup({ closeButton: true, closeOnClick: true, maxWidth: 'none' }) })); // Add the tile boundaries control to the map map.addControl(new MaplibreTileBoundaries({ showBoundaries: false })); ``` -------------------------------- ### Apache Baremaps Data Storage API Reference Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-data/README.md This section provides a structured reference for the main interfaces and classes within the `org.apache.baremaps.data.storage` package, which are designed to handle large datasets with dynamically discovered structures. It outlines their methods, properties, and relationships. ```APIDOC DataColumn: name(): String type(): Type DataSchema: name(): String columns(): List createRow(): DataRow DataRow: schema(): DataSchema values(): List get(column: String): Object get(index: int): Object set(column: String, value: Object): void set(index: int, value: Object): void with(column: String, value: Object): DataRow with(index: int, value: Object): DataRow DataTable: schema(): DataSchema add(row: DataRow): boolean clear(): void size(): long iterator(): Iterator DataStore: list(): List get(name: String): DataTable add(table: DataTable): void add(name: String, table: DataTable): void remove(name: String): void ``` -------------------------------- ### Basic CSS for Map Container Layout Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/static/viewer.html This CSS snippet provides fundamental styling for full-width/height map containers and a flexible column layout, commonly used to structure web pages displaying maps. ```css body { margin: 0; } .map-wrapper { position: relative; } .map { width: 100%; height: 100%; } .columns { display: flex; } .column { flex: 1; height: 100vh; } ``` -------------------------------- ### Basic CSS for Full-Screen Map Container Source: https://github.com/apache/incubator-baremaps/blob/main/examples/openstreetmap/index.html Provides minimal CSS to ensure the map container (`#map`) occupies the full viewport, removing default body margins and setting fixed positioning. ```CSS body { margin: 0; } #map { position: fixed; width: 100%; height: 100%; } ``` -------------------------------- ### Initialize MapLibre GL JS Map with Controls and RTL Plugin Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/index.html Initializes a MapLibre GL JS map, setting its container, style, and hash tracking. It conditionally loads the right-to-left text plugin if unavailable and adds navigation, inspection (with custom popup configuration), and tile boundaries controls to enhance user interaction and debugging. ```JavaScript // Load the right-to-left plugin if necessary. if (maplibregl.getRTLTextPluginStatus() === 'unavailable') { maplibregl.setRTLTextPlugin( 'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js', null, true ); } // Initialize the map let map = new maplibregl.Map({ container: 'map', style: '/style.json', hash: true }); // Add the navigation control to the map map.addControl(new maplibregl.NavigationControl()); // Add the inspect control to the map map.addControl(new MaplibreInspect({ showMapPopup: true, showMapPopupOnHover: false, showInspectMapPopupOnHover: false, popup: new maplibregl.Popup({ closeButton: true, closeOnClick: true, maxWidth: 'none' }) })); // Add the tile boundaries control to the map map.addControl(new MaplibreTileBoundaries({ showBoundaries: false })); ``` -------------------------------- ### Recommended PostgreSQL Configuration for Large Baremaps Imports Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/README.md These PostgreSQL configuration settings are recommended for machines importing the whole planet data with Baremaps. They increase memory allocations and parallel processing capabilities to improve import performance and stability. ```PostgreSQL Config work_mem = 4GB shared_buffers = 4GB maintenance_work_mem = 16GB autovacuum_work_mem = 4GB max_worker_processes = 16 max_parallel_workers_per_gather = 8 max_parallel_workers = 16 wal_level = minimal checkpoint_timeout = 10min max_wal_size = 20GB min_wal_size = 80MB checkpoint_completion_target = 0.9 max_wal_senders = 0 ``` -------------------------------- ### Set Apache Baremaps Release Version and Commit Source: https://github.com/apache/incubator-baremaps/blob/main/RELEASE.md Update the project's version to the designated `RELEASE_VERSION` using Maven, ensuring no backup POMs are generated. Commit these version changes to Git with a clear message and push the new release branch to the remote origin. ```bash ./mvnw versions:set -DnewVersion=$RELEASE_VERSION -DgenerateBackupPoms=false git commit -a -m "Release Baremaps $RELEASE_VERSION" git push --set-upstream origin release-$RELEASE_VERSION ``` -------------------------------- ### Initialize MapLibre GL JS Map with Elevation and Hillshade Layers Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-server/src/main/resources/dem/index.html Initializes a MapLibre GL JS map instance, setting its container, initial zoom, center, and style. The style defines multiple raster and vector sources for elevation and hillshade data, pointing to local tile servers. It also defines various layers to render these sources with specific styling, including background, raster elevation, raster hillshade, vector hillshade (with level-based coloring), and vector contours. ```JavaScript const map = (window.map = new maplibregl.Map({ antialias: true, container: 'map', zoom: 11, center: [11.5519, 47.2719], hash: true, style: { version: 8, sources: { rasterElevationSource: { type: 'raster', 'tiles': [ 'http://localhost:9000/raster/elevation/{z}/{x}/{y}.png' ], tileSize: 256 }, rasterHillshadeSource: { type: 'raster', 'tiles': [ 'http://localhost:9000/raster/hillshade/{z}/{x}/{y}.png' ], tileSize: 256 }, vectorContourSource: { type: 'vector', tiles: [ 'http://localhost:9000/vector/contour/{z}/{x}/{y}.mvt' ] }, vectorHillshadeSource: { type: 'vector', tiles: [ 'http://localhost:9000/vector/hillshade/{z}/{x}/{y}.mvt' ] } }, layers: [ { 'id': 'background', 'type': 'background', 'paint': { 'background-color': '#bdbdbd' } }, { 'id': 'rasterElevation', 'type': 'raster', 'source': 'rasterElevationSource', 'paint': { 'raster-opacity': 0.5 } }, { 'id': 'rasterHillshade', 'type': 'raster', 'source': 'rasterHillshadeSource', 'paint': { 'raster-opacity': 0.5 } }, { 'id': 'vectorHillshade', 'type': 'fill', 'source': 'vectorHillshadeSource', 'source-layer': 'elevation', "layout" : { "visibility" : "visible", "fill-sort-key": [ "match", ["get", "level"], "1", 6, "2", 5, "3", 1, "4", 2, "5", 3, "6", 4, 0 ] }, "paint" : { "fill-color" : [ "match", ["get", "level"], "1", "#ffffff", "2", "#d9d9d9", "3", "#919191", "4", "#595959", "5", "#343434", "6", "#181818", "rgba(0,0,0,0)" ], "fill-opacity" : 0.8, "fill-antialias" : false } }, { 'id': 'vectorContour', 'type': 'line', 'source': 'vectorContourSource', 'source-layer': 'contour', "layout" : { "visibility" : "visible" }, "paint" : { "line-color" : "#000000" } } ] }, maxZoom: 18, maxPitch: 85 })); ``` -------------------------------- ### JavaScript Templates for Baremaps Test Report Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/assets/report-template.html This JavaScript code defines string templates used to render the summary and individual test results within the Baremaps integration testing report. The templates include placeholders (e.g., {{ TOT_TESTS }}, {{ TEST_NAME }}) that are dynamically replaced with actual test data during rendering. ```JavaScript const SUMMARY_TEMPLATE = `

Summary

Out of {{ TOT_TESTS }} tests:

  • {{ TOT_PASS_TESTS }} tests passed
  • {{ TOT_FAIL_TESTS }} tests failed
`; const getTestTemplate = (passed, index) => { const loading = index > 2 ? 'lazy' : 'eager'; return `

${passed ? 'PASSED' : 'FAILED'}

{{ TEST_NAME }}

{{ TEST_PATH }}

{{ MAP_URL }}

  {{ METADATA }} 

Expected

Actual

Difference ({{ DIFF }})

`; }; ``` -------------------------------- ### JavaScript Test Data Sorting and Dynamic HTML Rendering Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/assets/report-template.html This snippet sorts an array of test data (`sortedTestData`) based on user-defined criteria (name, diff, success status). It then iterates through the sorted data to dynamically create and append HTML elements representing each test result. The code populates a template with test-specific information, including image paths and metadata, and appends the generated HTML to a `testResultsDiv` element. ```JavaScript t((a, b) => (a.name > b.name ? 1 : -1)) : sortedTestData.sort((a, b) => (a.name < b.name ? 1 : -1)); } if (sortedBy.diff.active) { sortedBy.diff.asc ? sortedTestData.sort((a, b) => a.diff - b.diff) : sortedTestData.sort((a, b) => b.diff - a.diff); } if (sortedBy.status.active) { sortedBy.status.asc ? sortedTestData.sort((a, b) => a.success === b.success ? 0 : a.success ? -1 : 1, ) : sortedTestData.sort((a, b) => a.success === b.success ? 0 : a.success ? 1 : -1, ); } sortedTestData.forEach((test, index) => { const testDiv = document.createElement('div'); testDiv.innerHTML = getTestTemplate(test.success, index); testDiv.innerHTML = testDiv.innerHTML .replace('{{ TEST_NAME }}', test.name) .replace('{{ TEST_PATH }}', test.path) .replace( // replace all occurrences of the map url new RegExp('{{ MAP_URL }}', 'g'), `https://demo.baremaps.com/#${test.metadata.zoom}/${test.metadata.center[1]}/${test.metadata.center[0]}`, ) .replace('{{ METADATA }}', JSON.stringify(test.metadata, null, 4)) .replace('{{ DIFF }}', test.diff) .replace( '{{ EXPECTED_IMG_PATH }}', test.expectedImagePath + `?ts=${ts}`, ) .replace('{{ ACTUAL_IMG_PATH }}', test.actualImagePath + `?ts=${ts}`) .replace('{{ DIFF_IMG_PATH }}', test.diffImagePath + `?ts=${ts}`); testResultsDiv.appendChild(testDiv); }); }; render(); ``` -------------------------------- ### PostgreSQL JDBC Connection String for Baremaps Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/README.md This snippet provides the default JDBC connection string for connecting to the PostgreSQL database used by Baremaps. It specifies the host, port, database name, username, and password for the connection. ```Connection String jdbc:postgresql://localhost:5432/baremaps?user=baremaps&password=baremaps ``` -------------------------------- ### Basic CSS for Full-Screen Map Container Source: https://github.com/apache/incubator-baremaps/blob/main/basemap/index.html Defines basic CSS rules to ensure the map container (`#map`) occupies the full viewport, removing default body margins to prevent scrollbars and ensure a seamless map display. ```CSS body { margin: 0; } #map { position: fixed; width: 100%; height: 100%; } ``` -------------------------------- ### Baremaps Renderer CSS Styling for Test Report Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/assets/report-template.html This CSS code defines the visual styles for the Baremaps Renderer integration testing report. It includes custom color variables, responsive design adjustments for different screen sizes, typography settings, and layout rules for displaying test summaries, individual test results, and image comparisons. ```CSS :root { --color-pass: rgb(40, 156, 40); --color-pass-transparent: rgba(40, 156, 40, 0.05); --color-error: rgb(255, 59, 59); --color-error-transparent: rgba(255, 59, 59, 0.05); } body { font-family: sans-serif; padding: 4rem 8rem; } @media (max-width: 768px) { body { padding: 4rem 0.5rem; } .results { gap: 0.5rem !important; } } .title { margin-bottom: 3rem; } h1 { font-size: 3rem; margin-top: 0; margin-bottom: 1rem; } h2 { font-size: 1.5rem; margin-top: 0; margin-bottom: 1rem; text-transform: uppercase; font-weight: 500; } h3 { font-size: 2rem; margin: 1rem 0; } h4 { font-size: 1.25rem; margin-bottom: 0; } h4.fail { margin-top: 0; text-transform: uppercase; color: var(--color-error); } h4.pass { margin-top: 0; text-transform: uppercase; color: var(--color-pass); } a { position: relative; text-decoration: underline; color: inherit; } pre { font-size: 1.25rem; } button { border: none; background-color: transparent; cursor: pointer; font-size: 1rem; padding: 0.25rem 0.5rem; border-radius: 0.25rem; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.075); } .sort { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; } .sort p { margin-right: 0.5rem; } .sort button.active { box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1); background-color: rgba(0, 0, 0, 0.075); } .results { display: flex; flex-direction: column; gap: 2rem; } .summary { border-left: 3px solid black; padding: 1rem 2rem; background-color: rgba(0, 0, 0, 0.05); } .summary h4 { text-transform: uppercase; margin-top: 1rem; } .p-pass { color: var(--color-pass); font-weight: bold; } .p-fail { color: var(--color-error); font-weight: bold; } .result { padding: 1rem 2rem; } .result.fail { border-left: 3px solid var(--color-error); background-color: var(--color-error-transparent); } .result.pass { border-left: 3px solid var(--color-pass); background-color: var(--color-pass-transparent); } pre { margin: 0; } .images { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; } img { width: 100%; aspect-ratio: 1; } ``` -------------------------------- ### Baremaps Renderer Test Metadata JSON Structure Source: https://github.com/apache/incubator-baremaps/blob/main/baremaps-renderer/README.md This JSON snippet defines the structure for the 'metadata.json' file used in Baremaps Renderer integration tests. It specifies the dimensions (width, height), map center coordinates (longitude, latitude), and zoom level for rendering the test image. ```json { "width": 512, "height": 512, "center": [6.6323, 46.5197], "zoom": 14 } ```