# Atlas Pro Germany QGIS Plugin

Embeds the Atlas Pro web application (https://atlas.geo-code.de) directly into a QGIS dock widget. This plugin provides a seamless way to browse, select, and export 1-meter high-resolution Digital Elevation Models (DEM) and Digital Surface Models (DSM) covering all of Germany. You can directly load your downloaded GeoTIFF/COG files into your QGIS project with a single click.

## Features
- **Integrated Atlas Pro Viewer:** Access the Atlas web application directly from within QGIS without switching windows.
- **High-Resolution Elevation Data:** Access 1-meter resolution DEM and DSM data derived from the official sources.
- **Region Export:** Select custom areas and export them as Cloud Optimized GeoTIFFs (COG).
- **1-Click QGIS Load:** Once an export is downloaded, easily add it your QGIS layer panel with the "Open in QGIS" button.

## Requirements
- QGIS version 3.0 or higher.
- An active internet connection.
- An account on [atlas.geo-code.de](https://atlas.geo-code.de) (registration required to create export jobs).

## Installation

### Manual Installation
1. Download or clone this repository as `atlas_pro_germany`.
2. Move the `atlas_pro_germany` folder to your QGIS python plugins directory.
   - On Windows: `C:\Users\<Username>\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\`
   - On Linux: `~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/`
   - On Mac OS: `~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/`
3. Restart QGIS, go to **Plugins** -> **Manage and Install Plugins...**, search for *Atlas Pro Germany*, and enable it.

### Troubleshooting and Compatibility

The Atlas Pro plugin requires the **QtWebEngine** component to embed the web application directly in QGIS. On some systems (especially Linux), this component might be missing from your Python environment.

#### Platform-Specific Installation for QtWebEngine

If you get the error `ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'`, please follow these instructions:

- **Windows (OSGeo4W)**:
  1. Open the **OSGeo4W Shell** tool.
  2. Execute python3 -m pip install PyQtWebEngine
  3. Restart QGIS.

- **Ubuntu / Debian / Mint**:
  ```bash
  sudo apt install python3-pyqt5.qtwebengine
  ```
- **Fedora**:
  ```bash
  sudo dnf install python3-qt5-webengine
  ```
- **macOS**:
  QGIS for macOS usually bundles all dependencies. If it is missing, ensure you are using the official QGIS.org distribution. If using Homebrew, ensure `pyqt@5` is correctly linked.

#### External Browser Mode (Zero-Dependency)

If you cannot or do not want to install `QtWebEngine`, the plugin will automatically switch to **External Browser Mode**. 
- The plugin icon will change to **Atlas Pro Germany (Browser)**.
- Clicking it will open the Atlas Pro web application in your system's default browser (Chrome, Firefox, etc.).
- The plugin will start a small local server so you can still use the **"Open in QGIS"** button on the website to load layers directly into your project.

## Usage
1. Click the **Atlas Pro Germany** icon in your QGIS toolbar, or go to the **Web** menu -> **Atlas Pro Germany** to open the panel.
2. The Atlas viewer will open in a dockable widget. 
3. Log in with your Atlas account if you wish to export data.
4. Draw a selection area or upload a shapefile of your region of interest.
5. Create your export order and complete the payment if applicable.
6. Once the GeoTIFF/COG file has finished generating, navigate to your finished jobs and click "Open in QGIS". The new raster layer will be loaded automatically into your active QGIS workspace.

## Screenshots

![Atlas Pro Germany 1](image1.png)
![Atlas Pro Germany 2](image2.png)
![Atlas Pro Germany 4](image4.png)
![Atlas Pro Germany 5](image5.png)

## License
This plugin is licensed under the terms of the GNU General Public License version 2 or greater (GPLv2+). See the LICENSE file for details.
