Utilities to integrate qgis-js into web applications
qgis-js Repository | qgis-js Website | "@qgis-js/utils
" package source
⚠️ 🧪 Work in progress! Currently this project is in public beta
npm install -S @qgis-js/utils
Provides an abstraction to load QGIS projects from various sources.
import { qgis } from "qgis-js";
import { useProjects } from "@qgis-js/utils";
const { api, fs } = await qgis();
const {
openProject,
loadLocalProject,
loadGithubProjects,
loadRemoteProjects,
} = useProjects(fs, (projectPath: string) => {
api.loadProject(projectPath);
});
The following project sources are supported:
Loads QGIS projects from the user's file system with the File System API
await openProject(await loadLocalProject());
Loads QGIS projects from a GitHub repository with the GitHub API
Fetches QGIS projects from a remote server with the Fetch API
- If
loadRemoteProjects
is invoked with a string as, it is assumed to be the URL of a JSON file with the following structure:
{
"name": "projects",
"path": "projects",
"type": "Folder",
"entries": [
{
"name": "village",
"path": "projects/village",
"type": "Folder",
"entries": [
{
"name": "project.qgs",
"path": "projects/village/project.qgs",
"type": "File"
},
{
"name": "rgb.tif",
"path": "projects/village/rgb.tif",
"type": "File"
}
]
}
]
}
- Otherwise a
Folder
object can also be passed directly toloadRemoteProjects
, see FileSystem.ts
This package uses SemVer for versioning. For the versions available, see the tags on this repository.