# 🔄 Merge Vector Layers - QGIS Plugin

[![QGIS Plugin](https://img.shields.io/badge/QGIS-Plugin-589632?style=flat&logo=qgis)](https://qgis.org)
[![Version](https://img.shields.io/badge/version-1.0.0-blue)](https://github.com/viquezr-dev/unir_capas_plugin)
[![License](https://img.shields.io/badge/license-GPLv3-green)](https://www.gnu.org/licenses/gpl-3.0.html)
[![Python](https://img.shields.io/badge/Python-3.12-3776AB?style=flat&logo=python&logoColor=white)](https://python.org)
[![GitHub Repo](https://img.shields.io/badge/GitHub-Repository-181717?style=flat&logo=github)](https://github.com/viquezr-dev/unir_capas_plugin)

**Merge Vector Layers** is a powerful QGIS plugin designed to unify multiple vector layers into a single dataset, automatically resolving data structure conflicts and Coordinate Reference System (CRS) mismatches.

**Repository:** [https://github.com/viquezr-dev/unir_capas_plugin](https://github.com/viquezr-dev/unir_capas_plugin)

---

## 📋 Overview

This plugin streamlines spatial data consolidation. Unlike native tools, it is optimized to handle layers with heterogeneous attribute schemas, ensuring that text data is never truncated and field lengths are adjusted dynamically.

### ✨ Key Features

* 🔄 **Batch Merging:** Combine multiple point, line, or polygon layers in one click.
* 📐 **Automatic Reprojection:** On-the-fly CRS transformation when input layers use different coordinate systems.
* 📊 **Smart Field Management:** Automatically identifies and applies the maximum field length to prevent data loss.
* ⚡ **Performance Optimized:** Features a real-time progress bar for handling large-scale datasets.
* 💾 **Multiple Formats:** Direct export to GeoPackage (`.gpkg`) and ESRI Shapefile (`.shp`).
* 📈 **Process Analytics:** Provides a detailed summary report upon completion.

---

## 🚀 How to Use

### 1. Initialization
* Open the plugin from the menu **Vector → Merge Vector Layers** or click the 🔄 icon in the toolbar.

### 2. Layer Selection
* Select the layers you wish to merge from the list.
* Use the **Select All** or **Clear** buttons for quick management.

### 3. Configuration
* **Field Length:** Enable "Use maximum field length" to ensure the output schema accommodates the longest strings from all input layers.
* **Output Path:** Choose your destination folder and preferred file format.

### 4. Execution
* Click **🚀 MERGE LAYERS**. Once finished, the resulting layer will be automatically added to your QGIS Layers panel.

---

## 📊 Sample Process Summary

Upon completion, a notification will display the following details:

> ✨ **Merge completed successfully!**
> * **Layers processed:** 5
> * **Total Features:** 1,234
> * **Total Attributes:** 15
> * **Target CRS:** EPSG:32617
> * **Layers reprojected:** 2

---

## 📥 Installation

### From GitHub (Recommended)
```bash
git clone https://github.com/viquezr-dev/unir_capas_plugin.git

Manual Method
Download this repository as a ZIP file from Releases

In QGIS, go to Plugins → Manage and Install Plugins

Select Install from ZIP and choose the downloaded file

Default Plugin Directories
If you prefer manual placement:

Windows: %AppData%\Roaming\QGIS\QGIS3\profiles\default\python\plugins\

Linux: ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/

macOS: ~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/

🛠️ Technical Requirements
Requirement	Minimum Version
QGIS	3.16+
Python	3.9+
OS	Windows, Linux, macOS

📂 Project Structure
text
unir_capas_plugin/
├── __init__.py          # Plugin initialization
├── unir_capas.py        # Main logic and processing engine
├── icon.png             # Plugin icon
├── metadata.txt         # Official QGIS metadata
└── README.md            # Documentation

🐛 Issue Tracking & Contributing
If you encounter any bugs or have feature requests:

Open an Issue: https://github.com/viquezr-dev/unir_capas_plugin/issues

Specify your QGIS version and steps to reproduce

To contribute code:

Fork the repository

Create a feature branch (git checkout -b feature/amazing-feature)

Commit your changes (git commit -m 'Add amazing feature')

Push to the branch (git push origin feature/amazing-feature)

Open a Pull Request

📄 License
This project is licensed under the GNU General Public License v3.0.
See the LICENSE file for details.

👨‍💻 Author
Raúl Víquez

✉️ Email: viquezr@gmail.com

🌐 GitHub: @viquezr-dev

🔗 Repository: https://github.com/viquezr-dev/unir_capas_plugin

🙏 Acknowledgments
Developed for the QGIS Community.

