Repository navigation
feat(map): reemplaza Google Maps por OpenStreetMap sin API key - #791
Closed
hectorpalmatellez wants to merge 2 commits into
Closed
hectorpalmatellez wants to merge 2 commits into
hectorpalmatellez wants to merge 2 commits into
Conversation
- geocoding con Nominatim y respaldo en Photon - mapa estático propio: 3x3 tiles OSM, recorte 600x400 y pin rojo - imagen servida por el bot en /map/:id.png (TTL 30 min) - timeout configurable (HUBOT_MAP_TIMEOUT_MS) y errores reales al usuario - cache de geocoding (10 min) y tiles (7 días) - 13 tests nuevos con nock
- estilos alternativos sin key: osmfr (default) y hot, con fallback a osm/osmde - zoom calculado con el bounding box del resultado, acotado por tipo de lugar - dirección queda en 17, ciudad en 10, región en 6-8 - marcador más grande - tests: fallback de proveedor y bbox anómalo (Valparaíso)
Contributor
|
Cierro este PR y lo reabro en uno nuevo desde la cuenta del bot ( Se abrió con un El código no cambia: misma rama |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Descripción
Reemplaza el script
map(Google Maps) por una implementación con OpenStreetMap y sin API keys. El script anterior ejecutaba pero ya no funcionaba: Google devolvíaREQUEST_DENIEDpara cualquier dirección y elcatchmostraba siempre "no retorna resultados".https://huemul.devschile.cl/map/<id>.png(TTL 30 min).osmfrpor defecto yhotdisponible conHUBOT_MAP_PROVIDER; si un estilo falla se usa el siguiente (tiles.openstreetmap.org,tile.openstreetmap.de).boundingboxdel resultado (log2 para que quepa en 600×400) y se acota por tipo de lugar. Dirección queda en 17, ciudad en 10, región en 6-8. El tope evita bboxes anómalos: Valparaíso trae un bbox del tamaño de la región y quedaba en zoom 6.HUBOT_MAP_TIMEOUT_MS(default 8s).© OpenStreetMap contributorsen el footer del mensaje.msg.send(mantiene el hilo) en vez de llamar al adapter.Nuevas variables de entorno opcionales:
HUBOT_MAP_PUBLIC_URL,HUBOT_MAP_TIMEOUT_MS,HUBOT_MAP_PROVIDER. Al desplegar se puede borrarGOOGLE_MAPS_API_KEY: ya no se usa.Ejemplo de comportamiento
Tests
yarn test test/map.test.js→ 16 tests: éxito con pin, fallback a Photon, sin resultados, HTTP 429, HTTP 500, JSON inválido, timeout, error de red, todos los tiles caídos (se entrega igual el link), fallback de proveedor de tiles, cache, zoom por bounding box, bbox anómalo, limpieza del texto de entrada y "no usa APIs de Google".yarn test→ 292 tests passed.eslint scripts/map.js test/map.test.jssin errores.