Geocodificador asíncrono para Cataluña usando el servicio ICGC
Project description
GeoFinder-ICGC
Geocodificador para Cataluña usando el servicio del ICGC (Institut Cartogràfic i Geològic de Catalunya). 🔄 API dual: Async nativo + wrappers sync para scripts simples.
GeoFinder-ICGC es un geocodificador avanzado para Cataluña diseñado para ser robusto, rápido y fácil de usar.
🚀 Instalación
# Instalación básica
pip install geofinder-icgc
# Con soporte para transformación de coordenadas (recomendado)
pip install geofinder-icgc[pyproj]
# Con soporte para servidor MCP (integración con IA)
pip install geofinder-icgc[mcp]
📖 Inicio Rápido
Uso Síncrono (Scripts sencillos)
from geofinder import GeoFinder
gf = GeoFinder()
results = gf.find_sync("Barcelona")
for r in results:
print(f"{r.nom} ({r.nomTipus}) - {r.x}, {r.y}")
Uso Asíncrono (Alto rendimiento)
import asyncio
from geofinder import GeoFinder
async def main():
async with GeoFinder() as gf:
results = await gf.find("Diagonal 100, Barcelona")
print(f"Encontrados: {len(results)}")
asyncio.run(main())
🔍 Manual de Funcionalidades
1. Búsqueda General (find / find_sync)
Detecta automáticamente el tipo de búsqueda según la entrada:
- Topónimos:
"Montserrat","Girona" - Direcciones:
"Carrer Aragó 50, Barcelona","Gran Via 123" - Coordenadas:
"430000 4580000 EPSG:25831","2.17 41.38 EPSG:4326" - Carreteras:
"C-32 km 10" - Rectángulos:
"X1 Y1 X2 Y2"
2. Geocodificación Inversa (find_reverse / find_reverse_sync)
Encuentra lugares o direcciones a partir de coordenadas.
# Soporta EPSG:25831 (por defecto) y EPSG:4326 (GPS)
results = await gf.find_reverse(430000, 4580000)
3. Autocompletado (autocomplete / autocomplete_sync)
Ideal para implementar buscadores en tiempo real.
suggestions = await gf.autocomplete("Barcel")
4. Búsqueda de Proximidad (search_nearby)
Encuentra lugares en un radio determinado alrededor de un punto de referencia.
# Busca todo en un radio de 2km de la Sagrada Família
nearby = await gf.search_nearby("Sagrada Família, Barcelona", radius_km=2.0)
5. Procesamiento por Lotes (find_batch / find_reverse_batch)
Ejecuta múltiples consultas en paralelo optimizando la concurrencia.
queries = ["Barcelona", "Girona", "Lleida", "Tarragona"]
batch_results = await gf.find_batch(queries, max_concurrency=10)
6. Obtención de Respuestas con Metadatos (find_response)
Devuelve un objeto GeoResponse que incluye los resultados y metadatos de rendimiento como el tiempo de ejecución.
⚙️ Configuración
El constructor de GeoFinder permite ajustar el comportamiento de la librería:
| Parámetro | Tipo | Descripción |
|---|---|---|
timeout |
int |
Tiempo máximo de espera (defecto: 5s). |
cache_size |
int |
Capacidad de la caché LRU (defecto: 128). |
cache_ttl |
int |
Tiempo de vida de la caché en segundos (defecto: 3600). |
max_retries |
int |
Número de reintentos en caso de fallo (defecto: 3). |
verify_ssl |
bool |
Verificar certificados SSL (defecto: True). |
📚 Documentación
- COOKBOOK.md - Tutoriales y ejemplos prácticos
- README-DEV.md - Guía de desarrollo
- README-MCP.md - Servidor MCP
- README-ARQ.md - Arquitectura técnica
📚 Recursos
⚖️ Licencia
Distribuido bajo la licencia GPL-2.0-or-later. Basado en el trabajo original del ICGC adaptado para uso standalone.
© 2025 ICGC / Adaptado por Goalnefesh
Els petits canvis son poderosos 🤘
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file geofinder_icgc-2.3.0.tar.gz.
File metadata
- Download URL: geofinder_icgc-2.3.0.tar.gz
- Upload date:
- Size: 41.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c92e2b9c4f6156b413414b8de01df51f2667b40476f0f82f811d092997a27ad6
|
|
| MD5 |
c9c21345b5fd6a2ccea28d4f6f89af10
|
|
| BLAKE2b-256 |
158176702c68fe19a21a608a3ca3674aa0119e1d16782c94b7bd6df9dc6fa793
|
Provenance
The following attestation bundles were made for geofinder_icgc-2.3.0.tar.gz:
Publisher:
publish.yml on jccamel/geofinder-icgc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geofinder_icgc-2.3.0.tar.gz -
Subject digest:
c92e2b9c4f6156b413414b8de01df51f2667b40476f0f82f811d092997a27ad6 - Sigstore transparency entry: 779520852
- Sigstore integration time:
-
Permalink:
jccamel/geofinder-icgc@bf522f2c412d39b04884fda0e682e3d9f4094b61 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/jccamel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf522f2c412d39b04884fda0e682e3d9f4094b61 -
Trigger Event:
push
-
Statement type:
File details
Details for the file geofinder_icgc-2.3.0-py3-none-any.whl.
File metadata
- Download URL: geofinder_icgc-2.3.0-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ccfc9bdf53eb5df37fc00d96212596ea250027f63c26b4cea5156c0ef49c28
|
|
| MD5 |
a62daa50c8c9ad587ed5c58678aad1d9
|
|
| BLAKE2b-256 |
f8bc1c9dc0ff43f0eb285590c58b7338d9a646499e9c3cc2a67241dc616b266e
|
Provenance
The following attestation bundles were made for geofinder_icgc-2.3.0-py3-none-any.whl:
Publisher:
publish.yml on jccamel/geofinder-icgc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
geofinder_icgc-2.3.0-py3-none-any.whl -
Subject digest:
c6ccfc9bdf53eb5df37fc00d96212596ea250027f63c26b4cea5156c0ef49c28 - Sigstore transparency entry: 779520853
- Sigstore integration time:
-
Permalink:
jccamel/geofinder-icgc@bf522f2c412d39b04884fda0e682e3d9f4094b61 -
Branch / Tag:
refs/tags/v2.3.0 - Owner: https://github.com/jccamel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf522f2c412d39b04884fda0e682e3d9f4094b61 -
Trigger Event:
push
-
Statement type: