Adding data
Based on the RustGIS user guide, Data (read_doc {"page": "user-guide/data.md"}). Every format
and its limits are listed in user-guide/data-formats.md.
- A file on this computer:
layer.addData {"path": P}. Reading files asks the user first.
A GeoPackage, GDAL or DuckDB file with several layers takes "layer".
- CSV / TSV: points come from
"x" and "y" columns, or a "wkt" column. When the
coordinates aren't longitude/latitude, give their "crs" ("EPSG:2271"). Without it, projected
coordinates land in the wrong place. Use "delimiter" when it isn't a comma.
- A web address:
layer.addUrl {"url": U} for GeoJSON, CSV, GeoParquet, FlatGeobuf,
GeoPackage, zipped Shapefiles, KML/KMZ, GPX, GeoTIFF or a PMTiles archive. This uses the
network, so the user is asked first.
- SQL:
layer.addSql {"sql": "SELECT … FROM read_parquet('…')"} runs one DuckDB query
(DuckDB Spatial's ST_ functions; PostgreSQL through "database"). It needs DuckDB installed on
the desktop.
- Databases:
layer.addDatabase {"database": D, "password"?: P} adds the tables with
geometry of a PostgreSQL/PostGIS connection (postgres:host=… dbname=…), a MySQL or MariaDB
address (mysql://user@host:3306/database) or a .duckdb file; info.databaseTables lists
them first. Desktop only.
- Catalogs: STAC, Overture Maps, Source Cooperative, OpenStreetMap and open-data portals are
described in
user-guide/data.md; find their commands with search_commands ("stac", "overture",
"openstreetmap").
- Web tiles: basemaps and tile services go through
map.addTiles {"url": …}, not
layer.addData.
After adding: list_layers confirms the layer, its geometry type, feature count and fields, and
layer.zoomTo frames it. If a layer lands in the wrong place, its coordinate system was wrong:
remove it (layer.remove) and add it again with the right "crs". Large files may load a
sample first; layer.loadAll loads every feature.
1---2name: add-data3description: Add data to the map — files (GeoJSON, CSV with coordinates, Shapefile, GeoPackage, GeoParquet, FlatGeobuf, KML, GPX, GeoTIFF, LiDAR), web addresses, DuckDB SQL queries, STAC catalogs and Overture Maps — with the right coordinate system. Use for "open", "load", "add", "import", "show this file/URL".4metadata:5 source: https://skillmd.com/skills/opengeos/add-data6---78# Adding data910Based on the RustGIS user guide, Data (`read_doc` `{"page": "user-guide/data.md"}`). Every format11and its limits are listed in `user-guide/data-formats.md`.1213- **A file on this computer:** `layer.addData` `{"path": P}`. Reading files asks the user first.14 A GeoPackage, GDAL or DuckDB file with several layers takes `"layer"`.15- **CSV / TSV:** points come from `"x"` and `"y"` columns, or a `"wkt"` column. When the16 coordinates aren't longitude/latitude, give their `"crs"` (`"EPSG:2271"`). Without it, projected17 coordinates land in the wrong place. Use `"delimiter"` when it isn't a comma.18- **A web address:** `layer.addUrl` `{"url": U}` for GeoJSON, CSV, GeoParquet, FlatGeobuf,19 GeoPackage, zipped Shapefiles, KML/KMZ, GPX, GeoTIFF or a PMTiles archive. This uses the20 network, so the user is asked first.21- **SQL:** `layer.addSql` `{"sql": "SELECT … FROM read_parquet('…')"}` runs one DuckDB query22 (DuckDB Spatial's `ST_` functions; PostgreSQL through `"database"`). It needs DuckDB installed on23 the desktop.24- **Databases:** `layer.addDatabase` `{"database": D, "password"?: P}` adds the tables with25 geometry of a PostgreSQL/PostGIS connection (`postgres:host=… dbname=…`), a MySQL or MariaDB26 address (`mysql://user@host:3306/database`) or a `.duckdb` file; `info.databaseTables` lists27 them first. Desktop only.28- **Catalogs:** STAC, Overture Maps, Source Cooperative, OpenStreetMap and open-data portals are29 described in `user-guide/data.md`; find their commands with `search_commands` ("stac", "overture",30 "openstreetmap").31- **Web tiles:** basemaps and tile services go through `map.addTiles` `{"url": …}`, not32 `layer.addData`.3334After adding: `list_layers` confirms the layer, its geometry type, feature count and fields, and35`layer.zoomTo` frames it. If a layer lands in the wrong place, its coordinate system was wrong:36remove it (`layer.remove`) and add it again with the right `"crs"`. Large files may load a37sample first; `layer.loadAll` loads every feature.