47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.7 KiB
3.7 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, params, output
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | params | output | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| overpass_nearby_pois | function | kt | infra | 1.0.0 | impure | fun overpassNearbyPois(lat: Double, lon: Double, radiusM: Int = 500, categories: List<String>? = null): List<POI> | Consulta la Overpass API (OpenStreetMap) para obtener POIs cercanos a una coordenada. Soporta 16 categorias mapeadas a tags OSM (amenity, tourism, historic, leisure, shop). Sin dependencias externas: solo Android SDK (HttpURLConnection + org.json). |
|
false | error_go_core |
|
false | kotlin/functions/infra/overpass_nearby_pois.kt |
|
Lista de POI con id OSM, coordenadas (lat/lon), nombre, categoria y mapa completo de tags OSM. Lanza RuntimeException si la API devuelve error HTTP o la respuesta no es JSON valido. |
Ejemplo
// Restaurantes y museos en un radio de 300 metros
val pois = overpassNearbyPois(
lat = 40.4168,
lon = -3.7038,
radiusM = 300,
categories = listOf("restaurant", "museum")
)
pois.forEach { poi ->
println("${poi.name} (${poi.category}) — lat=${poi.lat}, lon=${poi.lon}")
}
// Todos los POIs en 500 metros (null = todas las categorias)
val all = overpassNearbyPois(lat = 48.8566, lon = 2.3522)
println("Paris: ${all.size} POIs encontrados")
Categorias soportadas
| Categoria | Tag OSM |
|---|---|
| restaurant | amenity=restaurant |
| cafe | amenity=cafe |
| bar | amenity=bar |
| museum | tourism=museum |
| monument | historic=monument |
| park | leisure=park |
| library | amenity=library |
| theatre | amenity=theatre |
| cinema | amenity=cinema |
| gallery | tourism=gallery |
| historic | historic (wildcard) |
| tourism | tourism (wildcard) |
| shop | shop (wildcard) |
| hotel | tourism=hotel |
| pharmacy | amenity=pharmacy |
| hospital | amenity=hospital |
Query Overpass QL generada
[timeout:10][out:json];
(
node["amenity"="restaurant"](around:500,40.4168,-3.7038);
node["tourism"="museum"](around:500,40.4168,-3.7038);
);
out body;
Notas
- Usa
java.net.HttpURLConnectioncon POST ydata=<query_url_encoded>. - Timeouts: 10 segundos de conexion y lectura. La query QL tambien declara
[timeout:10]. - El tipo
POIse define en el mismo archivo comodata class. - El mapa
tagscontiene todos los tags OSM del nodo, no solo el de la categoria. - Si un nodo no tiene tag
name, el fallback es la categoria y luego "Unknown". - Las categorias wildcard (historic, tourism, shop) usan
node["key"](around:...)sin valor. - Lanza
RuntimeExceptionen caso de categorias invalidas, error HTTP, o JSON malformado. - Compatible con Android SDK >= 19 (API level 19 tiene org.json integrado).