diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 589093b..f6b5274 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-17T14:16:11","documenter_version":"1.4.1"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-06-17T14:31:55","documenter_version":"1.4.1"}} \ No newline at end of file diff --git a/dev/api/index.html b/dev/api/index.html index 419eb51..3d4c175 100644 --- a/dev/api/index.html +++ b/dev/api/index.html @@ -1,5 +1,5 @@ -API · QGIS

API

Table of Contents

Docstrings

QGIS.dfConstant
QGIS.df

A DataFrame containing the metadata for all available QGIS algorithms.

source
QGIS.AlgorithmType
QGIS.Algorithm(name)

Object representing a QGIS algorithm. The struct contains the help, metadata, and default parameters for the algorithm. Algorithms are callable and expect a String input (filename) and optional String output (filename).

Example

using QGIS, GeoJSON, Plots, GeoInterfaceRecipes
+API · QGIS

API

Table of Contents

Docstrings

QGIS.dfConstant
QGIS.df

A DataFrame containing the metadata for all available QGIS algorithms.

source
QGIS.AlgorithmType
QGIS.Algorithm(name)

Object representing a QGIS algorithm. The struct contains the help, metadata, and default parameters for the algorithm. Algorithms are callable and expect a String input (filename) and optional String output (filename).

Example

using QGIS, GeoJSON, Plots, GeoInterfaceRecipes
 
 buffer = QGIS.Algorithm("native:buffer", DISTANCE=0.1)
 
@@ -15,4 +15,4 @@
     plot(nc.geometry),
     plot(nc_buffered.geometry),
     layout = (2, 1)
-)
source
QGIS.helpMethod
help(alg)

Return the help (in JSON format) for the associated algorithm.

source
QGIS.metadataMethod
metadata(alg)

Return the associated metadata for a given algorithm. Returns the associated DataFrameRow from QGIS.df.

source
+)
source
QGIS.helpMethod
help(alg)

Return the help (in JSON format) for the associated algorithm.

source
QGIS.metadataMethod
metadata(alg)

Return the associated metadata for a given algorithm. Returns the associated DataFrameRow from QGIS.df.

source
diff --git a/dev/index.html b/dev/index.html index 95866d0..4128690 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -QGIS.jl · QGIS
+QGIS.jl · QGIS
diff --git a/dev/tutorial/index.html b/dev/tutorial/index.html index 7e0cdac..e2912a8 100644 --- a/dev/tutorial/index.html +++ b/dev/tutorial/index.html @@ -1,2 +1,2 @@ -Tutorial · QGIS

Tutorial

This tutorial will guide you through the process of finding and running a QGIS algorithm on geospatial data in Julia. What we'll do:

  1. Read in some GeoJSON data using GeoJSON.
  2. Find an algorithm for adding a buffer around the boundaries of the data.
  3. Run the algorithm on the data.
  4. Visualize the results.

Step 1: Load Required Packages

First, we need to load some Packages
  1. GeoJSON: for reading in GeoJSON data.
  2. QGIS: for finding and running algorithms.
  3. Plots: for visualizing the data.
  4. GeoInterfaceRecipes: for providing plot recipes for the GeoJSON data.
julia> using GeoJSON, QGIS, Plots, GeoInterfaceRecipes

Step 2: Read in GeoJSON data

Data

The test/ directory of QGIS contains a GeoJSON file named nc.geojson (the state boundaries of North Carolina).

julia> path = joinpath(dirname(pathof(QGIS)), "..", "test", "nc.geojson");
julia> nc = GeoJSON.read(path)Feature with 2D MultiPolygon geometry and 12 properties: (:geometry, :statehood, :group, :city, :landarea, :houseseats, :population, :waterarea, :capital, :name, :abbreviation, :area)
julia> plot(nc.geometry; aspect_ratio=:equal, linewidth=0);GKS: cannot open display - headless operation mode active

Step 3: Find a Buffer Algorithm

Algorithm Metadata

QGIS has an (unexported) df::DataFrame that holds all the metadata on the QGIS algorithms.

julia> QGIS.df0×0 DataFrame
Search for Buffer Algorithms
  • We can search for algorithms that contain the word "buffer" in their name.
julia> filter(x -> occursin("buffer", string(x.algorithm)), QGIS.df)0×0 DataFrame

Step 4: Run the Buffer Algorithm

`QGIS.Algorithm`
  • The QGIS.Algorithm holds the help, metadata, and parameters for a QGIS algorithm.
  • The constructor takes the algorithm name and parameters as keyword arguments.
  • Parameters and their assigned values are displayed in the Base.show method.
julia> alg = QGIS.Algorithm("native:buffer", DISTANCE=0.1)ERROR: ArgumentError: column name "algorithm" not found in the data frame since it has no columns
Running Algorithms
  • QGIS.Algorithms are callable and accepts optional input/output arguments to override the INPUT and OUTPUT parameters. Note that these arguments refer to file paths.
julia> output = alg(GeoJSON.write(tempname() * ".geojson", nc))ERROR: UndefVarError: `alg` not defined
julia> nc_buffered = GeoJSON.read(output)ERROR: UndefVarError: `output` not defined
julia> plot(nc_buffered.geometry; aspect_ratio=:equal, linewidth=0, color=2);ERROR: UndefVarError: `nc_buffered` not defined

Step 5: Visualize the Results

julia> plot(nc_buffered.geometry; aspect_ratio=:equal, linewidth=0, label="Buffered", color=2);ERROR: UndefVarError: `nc_buffered` not defined
julia> plot!(nc.geometry; aspect_ratio=:equal, linewidth=0, label="Original", color=1);

+Tutorial · QGIS

Tutorial

This tutorial will guide you through the process of finding and running a QGIS algorithm on geospatial data in Julia. What we'll do:

  1. Read in some GeoJSON data using GeoJSON.
  2. Find an algorithm for adding a buffer around the boundaries of the data.
  3. Run the algorithm on the data.
  4. Visualize the results.

Step 1: Load Required Packages

First, we need to load some Packages
  1. GeoJSON: for reading in GeoJSON data.
  2. QGIS: for finding and running algorithms.
  3. Plots: for visualizing the data.
  4. GeoInterfaceRecipes: for providing plot recipes for the GeoJSON data.
julia> using GeoJSON, QGIS, Plots, GeoInterfaceRecipes

Step 2: Read in GeoJSON data

Data

The test/ directory of QGIS contains a GeoJSON file named nc.geojson (the state boundaries of North Carolina).

julia> path = joinpath(dirname(pathof(QGIS)), "..", "test", "nc.geojson");
julia> nc = GeoJSON.read(path)Feature with 2D MultiPolygon geometry and 12 properties: (:geometry, :statehood, :group, :city, :landarea, :houseseats, :population, :waterarea, :capital, :name, :abbreviation, :area)
julia> plot(nc.geometry; aspect_ratio=:equal, linewidth=0);GKS: cannot open display - headless operation mode active

Step 3: Find a Buffer Algorithm

Algorithm Metadata

QGIS has an (unexported) df::DataFrame that holds all the metadata on the QGIS algorithms.

julia> QGIS.df0×0 DataFrame
Search for Buffer Algorithms
  • We can search for algorithms that contain the word "buffer" in their name.
julia> filter(x -> occursin("buffer", string(x.algorithm)), QGIS.df)0×0 DataFrame

Step 4: Run the Buffer Algorithm

`QGIS.Algorithm`
  • The QGIS.Algorithm holds the help, metadata, and parameters for a QGIS algorithm.
  • The constructor takes the algorithm name and parameters as keyword arguments.
  • Parameters and their assigned values are displayed in the Base.show method.
julia> alg = QGIS.Algorithm("native:buffer", DISTANCE=0.1)ERROR: ArgumentError: column name "algorithm" not found in the data frame since it has no columns
Running Algorithms
  • QGIS.Algorithms are callable and accepts optional input/output arguments to override the INPUT and OUTPUT parameters. Note that these arguments refer to file paths.
julia> output = alg(GeoJSON.write(tempname() * ".geojson", nc))ERROR: UndefVarError: `alg` not defined
julia> nc_buffered = GeoJSON.read(output)ERROR: UndefVarError: `output` not defined
julia> plot(nc_buffered.geometry; aspect_ratio=:equal, linewidth=0, color=2);ERROR: UndefVarError: `nc_buffered` not defined

Step 5: Visualize the Results

julia> plot(nc_buffered.geometry; aspect_ratio=:equal, linewidth=0, label="Buffered", color=2);ERROR: UndefVarError: `nc_buffered` not defined
julia> plot!(nc.geometry; aspect_ratio=:equal, linewidth=0, label="Original", color=1);