Skip to content

Latest commit

 

History

History
103 lines (67 loc) · 3.71 KB

README.md

File metadata and controls

103 lines (67 loc) · 3.71 KB

geostyler-qgis-plugin

A QGIS Plugin for exporting layer styles to different formats.

Experimental

Tested with QGIS 3.24.

Warning: In recent versions of QGIS (e.g. 3.34) the style exports are no longer working with the geostyler-qgis-parser. This may requires to the QGIS parser - see geostyler/geostyler-qgis-parser#455.

Installation

To test clone the repository, create a symlink pointing to your QGIS plugins directory, and get a prebuild copy of geostyler-cli. First clone the project.

git clone https://github.com/geostyler/geostyler-qgis-plugin C:\GitHub\geostyler-qgis-plugin

Next find the location of the QGIS plugins folder. You can find this in QGIS under Settings > User Profiles > Open Active Profile Folder. This folder should contain a python folder. The python folder should contain a plugins folder. If this has not yet been created you can create it manually.

Next we create a symbolic link to make the cloned GitHub repository appear in the QGIS plugins folder:

Windows Command Prompt:

mklink /D "%APPDATA%\QGIS\QGIS3\profiles\default\python\plugins\geostyler" "C:\GitHub\geostyler-qgis-plugin"

PowerShell:

$AppDataPath = [Environment]::GetFolderPath("ApplicationData")
$SourcePath = "C:\GitHub\geostyler-qgis-plugin\geostyler"
$LinkPath = Join-Path -Path $AppDataPath -ChildPath "QGIS\QGIS3\profiles\default\python\plugins\geostyler"

# Create symbolic link
New-Item -ItemType SymbolicLink -Path $LinkPath -Target $SourcePath

Bash (untested):

ln -s /path/to/source /home/username/.local/share/QGIS/QGIS3/profiles/default/python/plugins/geostyler

You should now be able to open Plugins > Manage and Install Plugins and find the GeoStyler plugin, and add it to QGIS.

Context menu

The plugin relies on geostyler-cli - GeoStyler's command-line tool. This needs to be available on the system path, or placed in the plugin folder.

Binary releases are available on the release pages, for example 4.0.0.

Example script in PowerShell:

$zipUrl = "https://github.com/geostyler/geostyler-cli/releases/download/v4.0.0/geostyler-cli-win.exe.zip"
$destinationPath = "C:\GitHub\geostyler-qgis-plugin\geostyler"
$zipFile = "$destinationPath\geostyler-cli-win.exe.zip"

Write-Host "Downloading ZIP file..."
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile

# Unzip the contents
Write-Host "Unzipping contents..."
Expand-Archive -Path $zipFile -DestinationPath $destinationPath -Force

Check that the program runs successfully on the command line:

cd C:\GitHub\geostyler-qgis-plugin\geostyler
./geostyler-cli --version
# v4.0.0

Now start QGIS and when right-clicking on vector or raster layers you should see the GeoStyler option in the context menu.

Plugin Usage

Right-click on a vector or raster layer and select "Export Style":

Context menu

Now you can choose the output format and output file location:

GeoStyler dialog

Development

  • The plugin skeleton code was created using "Plugin Builder 3".

  • "Plugin Reloader" was used to reload code following modifications.

  • Debug VS was used to debug the plugin using Visual Studio Code.