What is Q2G?
Q2G is a powerful QGIS plugin that streamlines the process of uploading layers and managing styles on GeoServer. It provides a user-friendly interface for:
- Uploading QGIS layers to GeoServer in multiple formats
- Managing SLD (Styled Layer Descriptor) styles
- Creating and managing GeoServer workspaces
- Previewing layers and styles before deployment
- Batch uploading multiple layers at once
- Supporting PostGIS, Shapefile, GeoPackage, and GeoTIFF formats
Key Features
📤 Multi-Format Upload
Upload Shapefiles, GeoPackages, GeoTIFF, PostGIS layers, and more directly to GeoServer.
🎨 Style Management
Export QGIS styles as SLD and upload them to GeoServer automatically.
📁 Workspace Management
Create, delete, and manage GeoServer workspaces and datastores.
👁️ Live Preview
Preview layers and styles in a web map before uploading.
📊 Batch Operations
Upload multiple layers at once with automatic style association.
🔄 Auto-Overwrite
Automatically replace existing layers and styles on GeoServer.
System Requirements
- QGIS: Version 3.16 or higher
- GeoServer: Version 2.19 or higher
- Python: 3.6 or higher (included with QGIS)
- Network: Direct access to GeoServer REST API
- Disk Space: Sufficient space for temporary files during upload
Before You Start
Make sure you have the following information ready:
- GeoServer URL: e.g., http://localhost:8080/geoserver
- GeoServer Username: Your GeoServer admin username
- GeoServer Password: Your GeoServer admin password
- Workspace Name: The target workspace on GeoServer (or create a new one)
- QGIS Layers: Layers you want to upload (vector or raster)
- GeoServer Importer Extension: Must be installed on GeoServer for layer uploads
CORS Configuration (Recommended)
CORS (Cross-Origin Resource Sharing) is recommended for the Preview feature, especially for local/development testing. It is good practice to enable CORS on your GeoServer.
How to Enable CORS in GeoServer
CORS must be configured manually in GeoServer's web.xml file:
- Navigate to your GeoServer installation directory
- Open
webapps/geoserver/WEB-INF/web.xml - Find the commented CORS filter section (search for "CORS")
- Uncomment the CORS filter and filter-mapping sections
- Restart GeoServer
Example CORS Configuration
Uncomment or add the following in web.xml:
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Note: For production environments, consider restricting allowedOrigins to specific domains instead of using *.
Quick Start Workflow
- Install the Plugin: Download and install Q2G from the QGIS Plugin Manager
- Configure Q2G: Enter your GeoServer URL, username, and password
- Select Workspace: Choose or create a workspace on GeoServer
- Select Layers: Check the QGIS layers you want to upload
- Configure Options: Set upload preferences (overwrite, auto-style, etc.)
- Upload: Click the Upload button and monitor the progress
- Verify: Check the log for any errors and verify on GeoServer
Understanding the Interface
The Q2G plugin is divided into several main areas:
Connection Panel
Located at the top of the plugin window, this is where you enter your GeoServer connection details:
- GeoServer URL: The base URL of your GeoServer instance
- Username: Your GeoServer admin username
- Password: Your GeoServer admin password
- Test Connection: Button to verify your connection
Workspace Selection
Choose the target workspace for your uploads:
- Dropdown list of existing workspaces
- Create New Workspace button
- Delete Workspace button
- Refresh button to reload workspace list
Layer Selection
Select which QGIS layers to upload:
- Tree view of all QGIS layers
- Checkboxes to select/deselect layers
- Layer information (type, size, format)
- Action buttons (Show SLD, Upload SLD, etc.)
Upload Options
Configure how your layers will be uploaded:
- Auto-Overwrite: Replace existing layers
- Upload SLD: Automatically upload layer styles
- Overwrite SLD: Replace existing styles
Upload Log
Real-time display of upload progress and status messages:
- Color-coded messages (green for success, red for errors)
- Detailed progress information
- Copy and Clear buttons
Supported Layer Formats
| Format | Type | Support | Notes |
|---|---|---|---|
| Shapefile (.shp) | Vector | ✅ Full | Most common format, fully supported |
| GeoPackage (.gpkg) | Vector | ✅ Full | Modern format, all features supported |
| GeoTIFF (.tif, .tiff) | Raster | ✅ Full | Raster imagery, styles fully supported |
| PostGIS | Vector | ✅ Full | Database layers, automatic registration |
| SQLite (.sqlite) | Vector | ✅ Full | Converted to Shapefile for upload |
Next Steps
Now that you understand the basics, proceed to:
- Installation Guide - Install the plugin
- Configuration - Set up your connection
- Layer Upload - Upload your first layer