Skip to main content

Geocodificador asíncrono para Cataluña usando el servicio ICGC

Project description

GeoFinder Logo 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.

Python 3.10+ License: GPL-2.0


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).

⚖️ 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

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

geofinder_icgc-2.2.0.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geofinder_icgc-2.2.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

Details for the file geofinder_icgc-2.2.0.tar.gz.

File metadata

  • Download URL: geofinder_icgc-2.2.0.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geofinder_icgc-2.2.0.tar.gz
Algorithm Hash digest
SHA256 1710f5e5f82458fc9939afa79427e2d8819cbeba8bac2b4b74ad1ae5aeeb649f
MD5 174cbf2a9918b7a93b88871e2265054f
BLAKE2b-256 1993cc4aafaf234055bcb537b096fd444e14c58a878e05430007d74234bbe2ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for geofinder_icgc-2.2.0.tar.gz:

Publisher: publish.yml on jccamel/geofinder-icgc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geofinder_icgc-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: geofinder_icgc-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for geofinder_icgc-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff7cbf3f44a8e393d18d93f68cd6493fef2abeaa20712456f18bd1b45b0f5a96
MD5 eab8264acac6e91c1d16c4750a72b345
BLAKE2b-256 7ae5df0bda6b8d5e6420631ab8b7260490a90d75c1bcac1e52dc8b61ebcf86ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for geofinder_icgc-2.2.0-py3-none-any.whl:

Publisher: publish.yml on jccamel/geofinder-icgc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page