src/georefar

    Dark Mode
Search:
Group by:

GeoRefAr

Example:

import src/georefar
import asyncdispatch, json
## Sync client.
let georefar_client = GeoRefAr(timeout: 99) # Timeout en Segundos.
## Las consultas en formato JSON son copiadas desde la Documentacion de la API.
var consulta = %* {"provincias": [{"id": "82"}]}
echo georefar_client.provincias(consulta).pretty

consulta = %* {"departamentos": [{"provincia": "Santa Fe"}]}
echo georefar_client.departamentos(consulta).pretty

consulta = %* {"municipios": [{"provincia": "Santa Fe"}]}
echo georefar_client.municipios(consulta).pretty

consulta = %* {"localidades": [{"provincia": "Santa Fe", "departamento": "Rosario", "municipio": "Granadero Baigorria"}]}
echo georefar_client.localidades(consulta).pretty

consulta = %* {"calles": [{"provincia": "Santa Fe", "departamento": "Rosario"}]}
echo georefar_client.calles(consulta).pretty

consulta = %* {"direcciones": [{"direccion": "Urquiza 400", "tipo": "calle", "provincia": "Santa Fe", "departamento": "Rosario"}]}
echo georefar_client.direcciones(consulta).pretty

consulta = %* {"ubicaciones": [{"lat": -32.8551545, "lon": -60.697636}]}
echo georefar_client.ubicacion(consulta).pretty
# Whole Dataset Downloads (takes a lot of time to complete!).
# georefar_client.provincias_dataset("provincias.json")
# georefar_client.departamentos_dataset("departamentos.json")
# georefar_client.municipios_dataset("municipios.json")
# georefar_client.localidades_dataset("localidades.json")
# georefar_client.calles_dataset("calles.json")

## Async client.
proc async_georefar() {.async.} = echo pretty(await AsyncGeoRefAr(timeout: 9).ubicacion(consulta))
wait_for async_georefar()

Types

GeoRefArBase[HttpType] = object
  proxy*: Proxy              ## Network IPv4 / IPv6 Proxy support, Proxy type.
  timeout*: byte             ## Timeout Seconds for API Calls, byte type, 0~255.
  
Base Object
GeoRefAr = GeoRefArBase[HttpClient]
GeoRefAr API Sync Client.
AsyncGeoRefAr = GeoRefArBase[AsyncHttpClient]
GeoRefAr API Async Client.

Consts

georefarApiUrl = "https://apis.datos.gob.ar/georef/api/"
Base API URL for all API calls (SSL).
georefarProvinciasDataset = "https://apis.datos.gob.ar/georef/api/provincias.json"
Dataset de Provincias (SSL).
georefarDepartamentosDataset = "https://apis.datos.gob.ar/georef/api/departamentos.json"
Dataset de Departamentos (SSL).
georefarMunicipiosDataset = "https://apis.datos.gob.ar/georef/api/municipios.json"
Dataset de Municipios (SSL).
georefarLocalidadesDataset = "https://apis.datos.gob.ar/georef/api/localidades.json"
Dataset de Localidades (SSL).
georefarCallesDataset = "https://apis.datos.gob.ar/georef/api/calles.json"
Dataset de Calles (SSL).

Procs

proc provincias(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de provincias en simultaneo.
proc provincias(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc departamentos(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de departamentos en simultaneo.
proc departamentos(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect,
    TimeEffect].}
proc municipios(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de municipios en simultaneo.
proc municipios(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc localidadesCensales(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de localidades censales en simultaneo.
proc localidadesCensales(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect,
    TimeEffect].}
proc asentamientos(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar busquedas sobre el listado de asentamientos BAHRA.
proc asentamientos(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect,
    TimeEffect].}
proc localidades(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de localidades en simultáneo.
proc localidades(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect,
    TimeEffect].}
proc calles(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar varias busquedas sobre el listado de vias de circulacion en simultaneo.
proc calles(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc direcciones(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite normalizar un lote de direcciones utilizando el listado de vias de circulacion.
proc direcciones(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect,
    TimeEffect].}
proc ubicacion(this: AsyncGeoRefAr; cueri: JsonNode): Future[JsonNode] {.
    ...raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect].}
Permite realizar una georreferenciacion inversa para varios puntos, informando cuales unidades territoriales contienen cada uno.
proc ubicacion(this: GeoRefAr; cueri: JsonNode): JsonNode {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError, JsonParsingError], tags: [RootEffect,
    ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc provinciasDataset(this: AsyncGeoRefAr; filename: string): owned(
    Future[void]) {....raises: [Exception], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect].}
Permite descargar el listado completo desde la API.
proc provinciasDataset(this: GeoRefAr; filename: string) {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc departamentosDataset(this: AsyncGeoRefAr; filename: string): owned(
    Future[void]) {....raises: [Exception], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect].}
Permite descargar el listado completo desde la API.
proc departamentosDataset(this: GeoRefAr; filename: string) {....raises: [
    Exception, LibraryError, SslError, IOError, ValueError, HttpRequestError,
    OSError, TimeoutError, ProtocolError, KeyError], tags: [RootEffect,
    ReadDirEffect, ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc municipiosDataset(this: AsyncGeoRefAr; filename: string): owned(
    Future[void]) {....raises: [Exception], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect].}
Permite descargar el listado completo desde la API.
proc municipiosDataset(this: GeoRefAr; filename: string) {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc localidadesDataset(this: AsyncGeoRefAr; filename: string): owned(
    Future[void]) {....raises: [Exception], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect].}
Permite descargar el listado completo desde la API.
proc localidadesDataset(this: GeoRefAr; filename: string) {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}
proc callesDataset(this: AsyncGeoRefAr; filename: string): owned(
    Future[void]) {....raises: [Exception], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect].}
Permite descargar el listado completo desde la API.
proc callesDataset(this: GeoRefAr; filename: string) {....raises: [Exception,
    LibraryError, SslError, IOError, ValueError, HttpRequestError, OSError,
    TimeoutError, ProtocolError, KeyError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, ReadIOEffect, WriteIOEffect, TimeEffect].}