Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ATTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ of use.
| File | Author / source | Licence |
|---|---|---|
| Interface themes (`crates/ui-egui/themes/light.json`, `dark.json`) | The RustGIS project | Apache-2.0 |
| Sample data (`countries`, `countries_chn`, `cities`, `rivers`, `lakes` GeoJSON), embedded at build time from [rustgis-assets](https://github.com/opengeos/rustgis-assets/tree/main/data) | Natural Earth 1:110m, attributes trimmed; `countries_chn` is Natural Earth's China point of view (1:10m, simplified) | Public domain |
| Sample data (`countries`, `cities`, `rivers`, `lakes` GeoJSON), embedded at build time from [rustgis-assets](https://github.com/opengeos/rustgis-assets/tree/main/data) | Natural Earth 1:110m, attributes trimmed | Public domain |
| Worldviews (`countries_<code>.geojson` and `original/countries_<code>.geojson.gz` on [source.coop](https://source.coop/opengeos/data/rustgis/worldviews)), downloaded by the app when one is chosen, not part of it | Natural Earth's Admin 0 Countries (1:10m) and its points of view, with the sample countries' attributes by `scripts/worldviews.py` in [rustgis-assets](https://github.com/opengeos/rustgis-assets): simplified to 1:110m density, or at their original detail | Public domain |
| QGIS screenshot (`qgis-world-atlas.webp` in [rustgis-assets](https://github.com/opengeos/rustgis-assets/tree/main/images)), on the [RustGIS and QGIS](docs/comparison/qgis.md) page | Taken by the RustGIS project: [QGIS](https://qgis.org) 4.2 showing the Natural Earth sample data above | QGIS is GPL-2.0-or-later; the data is public domain |
| QGIS test corpus (`crates/map/testdata/qgis/generated/`: styles, projects and their sample data) | Dominik Strebel ([@pick2510](https://github.com/pick2510)) for the RustGIS project: written by [QGIS](https://qgis.org) 4.2.3 through its API, from `generate.py` there; the data is made up | Apache-2.0 |
| JAXA Earth catalog test copy (`crates/tiles/tests/data/jaxa_catalog.v2.md`), read only by tests | JAXA: the [JAXA Earth API](https://data.earth.jaxa.jp/) dataset catalog ([catalog.v2.md](https://data.earth.jaxa.jp/app/mcp/catalog.v2.md)), copied on 2026-11-08 | JAXA's [terms of use](https://earth.jaxa.jp/en/data/policy/): free to use and redistribute, with credit to JAXA |
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Every screenshot is RustGIS itself, rendered offscreen by `cargo run -p rustgis-
| **Data** | GeoJSON, CSV/TSV with x/y columns in other coordinate systems or WKT geometry, Excel and OpenDocument spreadsheets, GeoRSS, LandXML, encoded polylines, Shapefile (zipped too, in the browser as well), GeoPackage, GeoParquet, FlatGeobuf, KML/KMZ (with styles), GPX, GML, MapInfo MIF/MID, OpenStreetMap PBF, TopoJSON, CityJSON, AutoCAD DXF, LiDAR point clouds (LAS, LAZ, COPC) and geotagged photos (large GeoPackage, GeoParquet and FlatGeobuf files, and Shapefiles on the desktop, are read in place), files by their web address, every vector format GDAL reads when it is installed (desktop), Esri File Geodatabases without GDAL (desktop), PostGIS, MySQL, MariaDB and SQL Server tables read live (desktop), and SQL queries and DuckDB databases through DuckDB Spatial when DuckDB is installed (desktop); PMTiles archives (by web address, or a file on the desktop) and MBTiles files; GeoJSON, CSV, GeoPackage (also as a table added to an existing file), GeoParquet, Shapefile, FlatGeobuf, KML/KMZ, GPX and WKT out (GeoPackage and FlatGeobuf not from the web app); standalone tables; reusable connections; Reload Data for linked files (desktop); geocoding (Find Place, address tables); a Data Sources pane (favourites, recent, saved services, a library) and an SQL pane (desktop); supported QGIS and GeoLibre projects and layer styles; layer and map files, styles, templates and packages |
| **Open data** | STAC search (Planetary Computer assets), NASA Earthdata imagery and granule search (GeoTIFFs added on the desktop), Hugging Face, Overture Maps, Source Cooperative, OpenStreetMap by area, geoBoundaries, CKAN, Socrata and ArcGIS Hub portals; S3 buckets with signed connections and a bucket browser; a Data Cubes pane with a catalog of cubes for the time slider (added on the desktop) |
| **Rasters** | GeoTIFF and cloud-optimised GeoTIFF (any pixel type, tiled or striped, compressed), ASCII grids, Zarr 2 and 3 stores (a variable at a time step, by web address, or folder on the desktop), and JPEG 2000, NetCDF, HDF, ERDAS Imagine and the other rasters GDAL reads when it is installed (desktop); reprojection by EPSG code; Stretch, RGB, Classify, Unique Values, Colormap and Shaded Relief; DRA, band combinations, brightness/contrast/gamma; raster functions, indices, change detection, classification, georeferencing; cloud-optimised GeoTIFF export (desktop); data cubes, point time-series charts (desktop), temporal summaries and trends (Sen's slope, Mann–Kendall); a spectral profile comparing a multiband raster's bands at points |
| **Maps** | Multiple maps and layouts per project, renamed and duplicated from the Browser pane; a GPU renderer (beta) with smooth zoom and pan; tilt, rotation, terrain and a 3D globe; maps of the Moon, Mars and other celestial bodies; Web Mercator or another projection (Equal Earth, Robinson, Winkel Tripel, polar and regional presets, or a [supported](docs/user-guide/maps.md#projections) projected EPSG or ESRI code); a search box for layers, places and coordinates; UTM and MGRS readouts; an on-map right-click menu (copy the coordinate, quick buffer, viewshed and line of sight); identify pop-ups with links and pictures; bookmarks, extent history, coordinate navigation; five offline basemaps, with borders in two worldviews |
| **Maps** | Multiple maps and layouts per project, renamed and duplicated from the Browser pane; a GPU renderer (beta) with smooth zoom and pan; tilt, rotation, terrain and a 3D globe; maps of the Moon, Mars and other celestial bodies; Web Mercator or another projection (Equal Earth, Robinson, Winkel Tripel, polar and regional presets, or a [supported](docs/user-guide/maps.md#projections) projected EPSG or ESRI code); a search box for layers, places and coordinates; UTM and MGRS readouts; an on-map right-click menu (copy the coordinate, quick buffer, viewshed and line of sight); identify pop-ups with links and pictures; bookmarks, extent history, coordinate navigation; five offline basemaps, with borders in 32 worldviews (31 downloaded when chosen) |
| **Web services** | WMS, WMTS, WFS, WCS, OGC API Features and Tiles, and ArcGIS REST (FeatureServer, MapServer, ImageServer, VectorTileServer) from their capabilities; CSW catalogue search; sign-in to ArcGIS Online and Enterprise, basic-auth and API-key logins; WMS and WMTS time on the time slider, legends and GetFeatureInfo |
| **Web tiles** | XYZ/TMS/WMS raster tiles, Mapbox Vector Tiles and MapLibre styles (sprites, patterns, expressions), cached and fetched in the background |
| **Cartography** | Single symbol, unique values (also by expression), graduated colours with seven classification methods and manual breaks, proportional symbols, pie and bar diagrams; symbol size, colour, width and angle, and label text, size, colour and angle, by expression; label classes with SQL queries, straight and curved line placement, installed font families (desktop), scale ranges and annotation; stacked and dashed line strokes, hatch, marker, gradient and shapeburst fills, custom colour ramps and the matplotlib colour maps, symbol levels, reference scales and polygons without fill; masking, display filters, aggregation bins, 2.5D extrusion; graphics and dynamic text |
Expand Down
61 changes: 50 additions & 11 deletions apps/rustgis-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use serde_json::{Map, Value, json};

fn usage() -> ExitCode {
eprintln!(
"usage:\n rustgis-cli commands | tools\n rustgis-cli plugins [install <file|folder> | uninstall <id> | enable <id> | disable <id> | browse | get <id> | prepare <id>] [--registry URL]\n rustgis-cli skills [add <SKILL.md|folder|.zip> | remove <name> | enable <name> | disable <name>]\n rustgis-cli info <data>\n rustgis-cli logo <out.png|out.ico|out.bmp> [--size N] [--canvas WxH --at X,Y (.bmp only)]\n rustgis-cli render <data|project> <out.png> [--basemap NAME] [--tiles URL] [--width N] [--height N] [--dpi N] [--worldview auto|default|china]\n rustgis-cli run [--sample] [--project P] [--data F]… --cmd 'id={{json}}'… [--save P] [--worldview auto|default|china]\n rustgis-cli ask [--sample] [--project P] [--data F]… \"request\" [--provider P] [--model M] [--base-url URL] [--yes] [--save P]\n rustgis-cli ask --models [--provider P]\n rustgis-cli ask --login [--another-account] [--account CLIENT_ID] | --logout\n rustgis-cli ask --accounts | --account CLIENT_ID | --remove-account CLIENT_ID\n common options: --use-saved-secrets (use the connections, passwords, keys, ChatGPT sign-in and Earthdata Login token the RustGIS app saved; reads the system keychain), --threads N (the most threads one piece of work uses, 1-1024; default: the cores, up to 16)\n rustgis-cli mcp [--sample] [--project P] [--data F]… [--yes] [--attach [PORT] [--token-file FILE] [--timeout SECONDS (5-600)]]\n rustgis-cli mcp-register [--client claude] [--name NAME] [--port PORT]"
"usage:\n rustgis-cli commands | tools\n rustgis-cli plugins [install <file|folder> | uninstall <id> | enable <id> | disable <id> | browse | get <id> | prepare <id>] [--registry URL]\n rustgis-cli skills [add <SKILL.md|folder|.zip> | remove <name> | enable <name> | disable <name>]\n rustgis-cli info <data>\n rustgis-cli logo <out.png|out.ico|out.bmp> [--size N] [--canvas WxH --at X,Y (.bmp only)]\n rustgis-cli render <data|project> <out.png> [--basemap NAME] [--tiles URL] [--width N] [--height N] [--dpi N] [--worldview auto|default|CODE] [--worldview-detail simplified|original]\n rustgis-cli run [--sample] [--project P] [--data F]… --cmd 'id={{json}}'… [--save P] [--worldview auto|default|CODE] [--worldview-detail simplified|original]\n rustgis-cli ask [--sample] [--project P] [--data F]… \"request\" [--provider P] [--model M] [--base-url URL] [--yes] [--save P]\n rustgis-cli ask --models [--provider P]\n rustgis-cli ask --login [--another-account] [--account CLIENT_ID] | --logout\n rustgis-cli ask --accounts | --account CLIENT_ID | --remove-account CLIENT_ID\n common options: --use-saved-secrets (use the connections, passwords, keys, ChatGPT sign-in and Earthdata Login token the RustGIS app saved; reads the system keychain), --threads N (the most threads one piece of work uses, 1-1024; default: the cores, up to 16)\n rustgis-cli mcp [--sample] [--project P] [--data F]… [--yes] [--attach [PORT] [--token-file FILE] [--timeout SECONDS (5-600)]]\n rustgis-cli mcp-register [--client claude] [--name NAME] [--port PORT]"
);
ExitCode::from(2)
}
Expand Down Expand Up @@ -248,10 +248,8 @@ fn configuration(provider: &str, args: &[String], env: &Environment, saved: Opti

const NEEDS_REQUEST: &str = "ask needs a request, e.g. rustgis-cli ask --sample \"Which countries have the largest GDP?\"";

/// `ask "<request>"`: one conversation turn with the AI assistant, which acts on the project.
fn ask(s: &mut Session, args: &[String], saved: Option<&Saved>, env: &Environment) -> Result<(), String> {
use rustgis_assistant::{Agent, Entry, agent, http};
// The first value that isn't an option's.
/// The request `ask` is given: its first argument that is neither an option nor an option's value.
fn ask_request(args: &[String]) -> Option<String> {
let takes_value = [
"--provider",
"--model",
Expand All @@ -263,16 +261,23 @@ fn ask(s: &mut Session, args: &[String], saved: Option<&Saved>, env: &Environmen
"--plugin",
"--registry",
"--worldview",
"--worldview-detail",
"--threads",
"--account",
"--remove-account",
];
let prompt = args
.iter()
args.iter()
.enumerate()
.skip(1)
.find(|(i, a)| !a.starts_with("--") && !args.get(i - 1).is_some_and(|p| takes_value.contains(&p.as_str())))
.map(|(_, a)| a.clone());
.map(|(_, a)| a.clone())
}

/// `ask "<request>"`: one conversation turn with the AI assistant, which acts on the project.
fn ask(s: &mut Session, args: &[String], saved: Option<&Saved>, env: &Environment) -> Result<(), String> {
use rustgis_assistant::{Agent, Entry, agent, http};
// The first value that isn't an option's.
let prompt = ask_request(args);
let provider = choose_provider(args, env, saved);
if provider::preset(&provider).is_none() {
let ids: Vec<&str> = provider::PRESETS.iter().map(|p| p.id).collect();
Expand Down Expand Up @@ -716,13 +721,47 @@ fn cli() -> ExitCode {
}
}
}
// Whose borders the built-in countries and world outline show: the system's by default.
// Whose borders the built-in countries and world outline show: the system's by default, at
// the simplified detail unless `--worldview-detail original`. A view other than the built-in
// one is downloaded (once: it is kept in the cache folder) by the subcommands that draw or
// open maps.
let worldview = opt(&args, "--worldview").unwrap_or("auto");
if worldview != "auto" && rustgis_engine::sample::Worldview::from_code(worldview).is_none() {
eprintln!("rustgis-cli: --worldview {worldview}: expected auto, default or china");
eprintln!("rustgis-cli: --worldview {worldview}: expected auto, default or a worldview's code (such as chn, ind or usa)");
return ExitCode::from(2);
}
let detail = opt(&args, "--worldview-detail").unwrap_or("simplified");
if rustgis_engine::sample::Detail::from_code(detail).is_none() {
eprintln!("rustgis-cli: --worldview-detail {detail}: expected simplified or original");
return ExitCode::from(2);
}
rustgis_engine::sample::apply_worldview(worldview);
let wanted = rustgis_engine::sample::wanted_view(worldview, detail);
// `mcp --attach` relays to the running app, which shows its own worldview; `ask`'s model,
// sign-in and account options draw nothing.
let attaching = cmd == "mcp" && args.iter().any(|a| a == "--attach");
let ask_setup = cmd == "ask"
&& (args.iter().any(|a| ["--models", "--login", "--logout", "--accounts", "--remove-account"].contains(&a.as_str()))
// Without a request, nothing is drawn by `--account`, nor unless a project is read or saved.
|| (ask_request(&args).is_none()
&& (args.iter().any(|a| a == "--account")
|| !args.iter().any(|a| ["--sample", "--project", "--data", "--save"].contains(&a.as_str())))));
if matches!(cmd, "render" | "run" | "ask" | "mcp")
Comment thread
giswqs marked this conversation as resolved.
Resolved
&& !attaching
&& !ask_setup
&& let Err(e) = rustgis_engine::sample::download_blocking(wanted)
{
// Asked for by name, it is needed; the system's choice falls back to the built-in borders.
if worldview != "auto" {
eprintln!("rustgis-cli: --worldview {worldview}: {e}");
return ExitCode::FAILURE;
}
if opt(&args, "--worldview-detail").is_some() {
Comment thread
giswqs marked this conversation as resolved.
Resolved
eprintln!("rustgis-cli: --worldview-detail {detail}: {e}");
return ExitCode::FAILURE;
}
eprintln!("rustgis-cli: warning: {e}; the map shows the default borders");
Comment thread
giswqs marked this conversation as resolved.
Resolved
}
rustgis_engine::sample::apply_view(worldview, detail);
// `--threads N` (or `--threads=N`): the most threads one piece of work uses (#1562), as
// `gp.threads` sets it.
let joined = args.iter().find_map(|a| a.strip_prefix("--threads="));
Expand Down
1 change: 1 addition & 0 deletions crates/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ geolibre = ["dep:rustgis-geolibre"]
testing = ["rustgis-plugins/testing"]

[dev-dependencies]
miniz_oxide = { workspace = true }
# Writing sample GeoPackages.
rusqlite = { workspace = true }
rustgis-plugins = { workspace = true, features = ["testing"] }
Expand Down
Loading
Loading