## Overview

Q2G allows you to upload layers from QGIS to GeoServer in multiple formats. The plugin handles format conversion, style export, and layer registration automatically.

### Supported Upload Methods

- Direct Upload: Shapefiles, GeoPackages, GeoTIFF
- Importer API: For complex formats and batch operations
- PostGIS Registration: Direct database layer registration
- Format Conversion: Automatic conversion for unsupported formats

## Preparing Layers for Upload

### Layer Requirements

- CRS (Coordinate Reference System): Must be defined and valid
- Geometry: Must be valid (no invalid geometries)
- Attributes: Column names should be simple (avoid special characters)
- Data Source: Must be accessible (local files or database)

### Checking Layer Properties

1. Right-click the layer in QGIS Layers panel
2. Select "Properties"
3. Check the "Information" tab for CRS and geometry details
4. Verify all information is correct

### Fixing Common Issues

- Missing CRS: Right-click layer → Set Layer CRS
- Invalid geometries: Use Vector → Geometry Tools → Fix Geometries
- Special characters in names: Rename layer or attributes

## Single Layer Upload

### Step-by-Step Process

Step 1: Configure Q2G Connection

Ensure your GeoServer connection is configured and tested (see Configuration guide)

Step 2: Select Workspace

Choose the target workspace from the Workspace dropdown

Step 3: Select Layer

In the QGIS Layers panel, check the checkbox next to the layer you want to upload

Step 4: Configure Options

Set upload options:

- Auto-Overwrite: Check if you want to replace existing layers
- Upload SLD: Check to upload layer styles
- Overwrite SLD: Check to replace existing styles

Step 5: Click Upload

Click the "Upload Layers" button to start the upload

Step 6: Monitor Progress

Watch the upload log for progress messages. The upload log shows:

- Green messages: Successful operations
- Red messages: Errors or failures
- Blue messages: Information and debug details

Step 7: Verify Upload

Check the log for success messages and verify on GeoServer

## Batch Layer Upload

Upload multiple layers at once for efficiency:

### Batch Upload Process

1. Select multiple layers by checking their checkboxes
2. Configure upload options (same as single upload)
3. Click "Upload Layers"
4. The plugin will upload layers sequentially
5. Monitor progress in the upload log

### Batch Upload Features

- Sequential Processing: Layers are uploaded one at a time
- Error Handling: Failure of one layer doesn't stop others
- Progress Tracking: See which layer is being processed
- Summary Report: Final report shows success/failure counts

### Best Practices for Batch Upload

- Start with a small batch (3-5 layers) to test
- Ensure all layers have valid CRS
- Check layer names don't conflict with existing layers
- Monitor the upload log for errors
- Verify results on GeoServer before uploading more

## Supported Layer Formats

### Vector Formats

Format | Extension | Upload Method | Notes
--- | --- | --- | ---
Shapefile | .shp | Direct/Importer | Most common, fully supported
GeoPackage | .gpkg | Importer | Modern format, supports multiple layers
SQLite | .sqlite | Converted to Shapefile | Automatically converted for upload
PostGIS | Database | Direct Registration | Database layers, no file needed

### Raster Formats

Format | Extension | Upload Method | Notes
--- | --- | --- | ---
GeoTIFF | .tif, .tiff | Importer | Georeferenced imagery, fully supported
JPEG2000 | .jp2 | Importer | Compressed imagery
PNG | .png | Importer | Requires georeferencing

## Upload Options Explained

### Auto-Overwrite Existing Layers

When to use: Updating existing layers on GeoServer

What it does:

- Checks if layer already exists on GeoServer
- Deletes the existing layer and datastore
- Uploads the new layer

Caution: This will delete all data associated with the existing layer

### Upload SLD Styles

When to use: When you want to apply QGIS styles to GeoServer layers

What it does:

- Exports the QGIS layer style as SLD
- Uploads the SLD to GeoServer
- Associates the style with the layer

Note: Not all QGIS styles can be perfectly converted to SLD

### Overwrite Existing Styles

When to use: Updating styles for existing layers

What it does:

- Replaces the existing SLD style
- Applies the new style to the layer

## Understanding Upload Progress

### Upload Log Messages

- ✓ (Green): Successful operation
- ✗ (Red): Error or failure
- ⚠ (Orange): Warning or non-critical issue
- ℹ (Blue): Information or debug message

### Typical Upload Sequence

1. Checking if layer exists on GeoServer
2. Deleting existing layer (if auto-overwrite enabled)
3. Creating import job
4. Uploading file to GeoServer
5. Executing import
6. Publishing layer
7. Exporting and uploading SLD style (if enabled)
8. Associating style with layer

## Handling Upload Errors

### Common Error Messages

- "Layer already exists": Enable Auto-Overwrite or use a different name
- "Invalid CRS": Set the layer's CRS in QGIS
- "Connection refused": Check GeoServer is running
- "Authentication failed": Verify username/password
- "File too large": Split into smaller files or increase GeoServer limits

### Troubleshooting Steps

1. Check the upload log for detailed error messages
2. Verify your GeoServer connection
3. Check layer properties (CRS, geometry, etc.)
4. Try uploading a different layer to test
5. Check GeoServer logs for server-side errors

## Upload Completion

### Success Indicators

- Upload log shows "✓ Layer uploaded successfully"
- No error messages in the log
- Layer appears in GeoServer workspace
- Style is applied (if SLD upload was enabled)

### After Upload

1. Verify the layer on GeoServer
2. Check if the style was applied correctly
3. Test the layer in a web map
4. Make any necessary adjustments

## Performance Tips

- File Size: Smaller files upload faster. Consider splitting large files.
- Network: Faster network = faster uploads. Check your connection speed.
- GeoServer Load: Upload during off-peak hours for better performance.
- Batch Size: Upload 5-10 layers at a time for optimal performance.
- Compression: Use compressed formats (GeoPackage) when possible.

## Next Steps

- Style Management - Manage layer styles
- Preview & Visualization - Preview your layers
- Troubleshooting - Solve common issues

↑