Skip to main content

Librería geo_tiles y library para tiles y utilidades GIS / Geo tiles and GIS utilities library

Project description

geomtiles

Utilidades para generación y caché de tiles MVT (multi-capa, CoW, filesystem/Redis).

English: Utilities for generating and caching MVT tiles (multi-layer, copy-on-write, filesystem/Redis backends).

Instalación / Installation

pip install geomtiles

Uso rápido / Quickstart

Español:

from geo_tiles import create_session_factory, TileService, LayerConfig

# Crear session factory (asyncpg)
sf = create_session_factory("postgresql+asyncpg://user:pass@host/db")

# Instanciar TileService
svc = TileService(sf)

# Registrar una capa
svc.register_layer(LayerConfig(
	name="buildings",
	schema="public",
	table="buildings_view",
	geom_column="geom",
	minzoom=10,
	maxzoom=20,
))

# Obtener un tile MVT (ejemplo, en contexto async)
# tile_bytes = await svc.get_mvt_tile(TileRequest(z=14, x=8345, y=6000, layers=["public.buildings.geom"]))

English:

from geo_tiles import create_session_factory, TileService, LayerConfig

# Create session factory (asyncpg)
sf = create_session_factory("postgresql+asyncpg://user:pass@host/db")

# Instantiate TileService
svc = TileService(sf)

# Register a layer
svc.register_layer(LayerConfig(
	name="buildings",
	schema="public",
	table="buildings_view",
	geom_column="geom",
	minzoom=10,
	maxzoom=20,
))

# Get an MVT tile (example, in async context)
# tile_bytes = await svc.get_mvt_tile(TileRequest(z=14, x=8345, y=6000, layers=['public.buildings.geom']))

Casos de uso / Use cases

  • Servir tiles XYZ MVT a partir de vistas PostGIS: use TileService.get_mvt_tile() con capas registradas.
  • Tiles multilayer (composición de varias capas) y caché en disco: configure FilesystemTileCache y páselo como tile_cache a TileService.
  • Consultas WFS-like (GeoJSON): use FeatureService y FeatureRequest para filtrar por bbox o polygon_wkt.

English:

  • Serve XYZ MVT tiles from PostGIS views: use TileService.get_mvt_tile() with registered layers.
  • Multilayer tiles (compose several layers) and disk cache: configure FilesystemTileCache and pass it as tile_cache to TileService.
  • WFS-like GeoJSON queries: use FeatureService and FeatureRequest to filter by bbox or polygon_wkt.

Ejemplos / Examples

Hay ejemplos ejecutables en la carpeta examples/ con instrucciones y scripts:

  • Ver examples/README.md para ejemplos completos bilingües (TileService, FeatureService, Cache).

Ejemplo: usar caché en disco sin expiración / Example: disk cache with no expiration

from geo_tiles.utils.tile_cache import FilesystemTileCache

# ttl=0 → no expira en disco
cache = FilesystemTileCache(cache_dir="/var/cache/geomtiles", ttl=0)
svc = TileService(sf, tile_cache=cache)

Más documentación / More documentation

Consulta los docstrings en los módulos geo_tiles.* para detalles de API, tipos y ejemplos adicionales.

English:

See the geo_tiles.* module docstrings for API details, types and more examples.

Licencia / License

Este proyecto se publica bajo la licencia MIT — ver el archivo LICENSE.

English:

This project is released under the MIT license — see the LICENSE file.

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

geomtiles-0.1.3.tar.gz (36.9 kB view details)

Uploaded Source

Built Distribution

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

geomtiles-0.1.3-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file geomtiles-0.1.3.tar.gz.

File metadata

  • Download URL: geomtiles-0.1.3.tar.gz
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for geomtiles-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5f65ce034fd5ea2184bd6a924493a6ef40a779b32d804e50f90c16e1a3392b8f
MD5 2a72f1fa68df18b4dabdf78923a7c5f6
BLAKE2b-256 ea0b5c93180643a839b4261ae361870ec4b0c75029fff63a54bfac9e68f546c5

See more details on using hashes here.

File details

Details for the file geomtiles-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: geomtiles-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 44.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for geomtiles-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1878cd2ad232510b2a7d9c6374cf075654f7a886ff57ec5632a8fc3868a68805
MD5 ec93b1be490a3389ddd597769d674b32
BLAKE2b-256 90b31e481fbd34f0437e811a95f420330bd3e3d9ed9b781c81b85caf48b1b1d1

See more details on using hashes here.

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