Access the GISCO Address API, that allows to carry out both geocoding and reverse geocoding using a pan-european address database.
Each endpoint available is implemented through a specific function, see Details.
The API supports fuzzy searching (also referred to as approximate string matching) for all parameters of each endpoint.
Usage
gisco_addressapi_search(
country = NULL,
province = NULL,
city = NULL,
road = NULL,
housenumber = NULL,
postcode = NULL,
verbose = FALSE
)
gisco_addressapi_reverse(x, y, country = NULL, verbose = FALSE)
gisco_addressapi_bbox(
country = NULL,
province = NULL,
city = NULL,
road = NULL,
postcode = NULL,
verbose = FALSE
)
gisco_addressapi_countries(verbose = FALSE)
gisco_addressapi_provinces(country = NULL, city = NULL, verbose = FALSE)
gisco_addressapi_cities(country = NULL, province = NULL, verbose = FALSE)
gisco_addressapi_roads(
country = NULL,
province = NULL,
city = NULL,
verbose = FALSE
)
gisco_addressapi_housenumbers(
country = NULL,
province = NULL,
city = NULL,
road = NULL,
postcode = NULL,
verbose = FALSE
)
gisco_addressapi_postcodes(
country = NULL,
province = NULL,
city = NULL,
verbose = FALSE
)
gisco_addressapi_copyright(verbose = FALSE)
Arguments
- country
Country code (
country = "LU"
).- province
A province within a country. For a list of provinces within a certain country use the provinces endpoint (
gisco_addressapi_provinces(country = "LU")
).- city
A city within a province. For a list of cities within a certain province use the cities endpoint (
gisco_addressapi_cities(province = "capellen")
).- road
A road within a city.
- housenumber
The house number or house name within a road or street.
- postcode
Can be used in combination with the previous parameters.
- verbose
Logical, displays information. Useful for debugging, default is
FALSE
.- x, y
x and y coordinates (as longitude and latitude) to be converted into a human-readable address.
Value
A data.frame
object in most cases, except gisco_addressapi_search()
,
gisco_addressapi_reverse()
and gisco_addressapi_bbox()
, that return a
sf
object.
Details
Brief description of the API endpoints (source GISCO Address API \> Endpoints:
Endpoint | Description |
/countries | Returns all country codes that are compatible with the address API. Check the coverage map for available countries and see here for a list of official country codes. |
/provinces | Returns all provinces within the specified country. Can also be used to get the province of a specified city. |
/cities | Returns all cities within a specified province or country. |
/roads | Returns all roads or streets within a specified city. |
/housenumbers | Returns all house numbers or names within the specified road. It is possible that in certain countries an address may not have a road component. In this case, if a road is not specified then the number of house numbers returned by the API is limited to 1000. |
/postcodes | Returns all postcodes within the specified address component (Country or Province or City). |
/search | The search endpoint allows structured queries to the address database. Please note that various combinations of each of the parameters can be used in order to retrieve the addresses that share an address component. The API is limited to a maximum of 100 addresses. |
/reverse | The API's reverse theme allows you to specify x and y coordinates in order to retrieve a structured address. |
/bbox | Returns a WKT bounding box for an address component depending on the parameters specified. |
/copyright | Returns the copyright text for each available country in the Address API. |
The resulting object may present the following variables:
Property name | Description |
LD | Refers to "Locator Designator" and represents the house number part of the address |
TF | Refers to "Thoroughfare" and represents the street or road part of the address |
L0 | Refers to Level 0 of the API administrative levels. Values are country codes consisting of 2 characters. |
L1 | Refers to Level 1 of the API administrative levels. Values are province names. Please note that "province" is a generic term that may differ between countries. |
L2 | Refers to Level 2 of the API administrative levels. Values are town or city names. Please note that "city" is a generic term that may differ between countries. |
PC | Postal Code |
N0 | Refers to "NUTS 0" |
N1 | Refers to "NUTS 1" |
N2 | Refers to "NUTS 2" |
N3 | Refers to "NUTS 3" |
X and Y | Refers to the x and y coordinates of the address point |
OL | Refers to the address' Open Location Code |
Examples
# \donttest{
# Cities in a region
gisco_addressapi_cities(country = "PT", province = "LISBOA")
#> L2
#> 1 AJUDA
#> 2 ALCABIDECHE
#> 3 ALCOENTRE
#> 4 ALCÂNTARA
#> 5 ALFRAGIDE
#> 6 ALGUBER
#> 7 ALGUEIRÃO-MEM MARTINS
#> 8 ALVALADE
#> 9 AREEIRO
#> 10 ARRANHÓ
#> 11 ARROIOS
#> 12 ARRUDA DOS VINHOS
#> 13 AVEIRAS DE BAIXO
#> 14 AVEIRAS DE CIMA
#> 15 AVENIDAS NOVAS
#> 16 AZAMBUJA
#> 17 BARCARENA
#> 18 BEATO
#> 19 BELÉM
#> 20 BENFICA
#> 21 BUCELAS
#> 22 CAMPO DE OURIQUE
#> 23 CAMPOLIDE
#> 24 CARDOSAS
#> 25 CARNIDE
#> 26 CARNOTA
#> 27 CARVOEIRA
#> 28 CASAL DE CAMBRA
#> 29 COLARES
#> 30 ENCARNAÇÃO
#> 31 ENCOSTA DO SOL
#> 32 ERICEIRA
#> 33 ESTRELA
#> 34 FALAGUEIRA-VENDA NOVA
#> 35 FANHÕES
#> 36 FREIRIA
#> 37 LOURES
#> 38 LOUSA
#> 39 LUMIAR
#> 40 MAFRA
#> 41 MARVILA
#> 42 MECA
#> 43 MILHARADO
#> 44 MINA DE ÁGUA
#> 45 MISERICÓRDIA
#> 46 MOITA DOS FERREIROS
#> 47 ODIVELAS
#> 48 OLHALVO
#> 49 OLIVAIS
#> 50 OTA
#> 51 PARQUE DAS NAÇÕES
#> 52 PENHA DE FRANÇA
#> 53 PERAL
#> 54 PONTE DO ROL
#> 55 PORTO SALVO
#> 56 RAMALHAL
#> 57 REGUENGO GRANDE
#> 58 RIBAMAR
#> 59 RIO DE MOURO
#> 60 S. TIAGO DOS VELHOS
#> 61 SANTA BÁRBARA
#> 62 SANTA CLARA
#> 63 SANTA MARIA MAIOR
#> 64 SANTA MARIA, SÃO PEDRO E MATACÃES
#> 65 SANTO ANTÓNIO
#> 66 SANTO ISIDORO
#> 67 SANTO QUINTINO
#> 68 SAPATARIA
#> 69 SILVEIRA
#> 70 SOBRAL DE MONTE AGRAÇO
#> 71 SÃO DOMINGOS DE BENFICA
#> 72 SÃO DOMINGOS DE RANA
#> 73 SÃO PEDRO DA CADEIRA
#> 74 SÃO VICENTE
#> 75 TURCIFAL
#> 76 UNIÃO DAS FREGUESIAS DE A DOS CUNHADOS E MACEIRA
#> 77 UNIÃO DAS FREGUESIAS DE ABRIGADA E CABANAS DE TORRES
#> 78 UNIÃO DAS FREGUESIAS DE AGUALVA E MIRA-SINTRA
#> 79 UNIÃO DAS FREGUESIAS DE ALDEIA GALEGA DA MERCEANA E ALDEIA GAVINHA
#> 80 UNIÃO DAS FREGUESIAS DE ALENQUER (SANTO ESTÊVÃO E TRIANA)
#> 81 UNIÃO DAS FREGUESIAS DE ALGÉS, LINDA-A-VELHA E CRUZ QUEBRADA-DAFUNDO
#> 82 UNIÃO DAS FREGUESIAS DE ALHANDRA, SÃO JOÃO DOS MONTES E CALHANDRIZ
#> 83 UNIÃO DAS FREGUESIAS DE ALMARGEM DO BISPO, PÊRO PINHEIRO E MONTELAVAR
#> 84 UNIÃO DAS FREGUESIAS DE ALVERCA DO RIBATEJO E SOBRALINHO
#> 85 UNIÃO DAS FREGUESIAS DE AZUEIRA E SOBRAL DA ABELHEIRA
#> 86 UNIÃO DAS FREGUESIAS DE CAMARATE, UNHOS E APELAÇÃO
#> 87 UNIÃO DAS FREGUESIAS DE CAMPELOS E OUTEIRO DA CABEÇA
#> 88 UNIÃO DAS FREGUESIAS DE CARCAVELOS E PAREDE
#> 89 UNIÃO DAS FREGUESIAS DE CARNAXIDE E QUEIJAS
#> 90 UNIÃO DAS FREGUESIAS DE CARREGADO E CADAFAIS
#> 91 UNIÃO DAS FREGUESIAS DE CARVOEIRA E CARMÕES
#> 92 UNIÃO DAS FREGUESIAS DE CASCAIS E ESTORIL
#> 93 UNIÃO DAS FREGUESIAS DE CASTANHEIRA DO RIBATEJO E CACHOEIRAS
#> 94 UNIÃO DAS FREGUESIAS DE DOIS PORTOS E RUNA
#> 95 UNIÃO DAS FREGUESIAS DE ENXARA DO BISPO, GRADIL E VILA FRANCA DO ROSÁRIO
#> 96 UNIÃO DAS FREGUESIAS DE IGREJA NOVA E CHELEIROS
#> 97 UNIÃO DAS FREGUESIAS DE LAMAS E CERCAL
#> 98 UNIÃO DAS FREGUESIAS DE LOURINHÃ E ATALAIA
#> 99 UNIÃO DAS FREGUESIAS DE MALVEIRA E SÃO MIGUEL DE ALCAINÇA
#> 100 UNIÃO DAS FREGUESIAS DE MANIQUE DO INTENDENTE, VILA NOVA DE SÃO PEDRO E MAÇUSSA
#> 101 UNIÃO DAS FREGUESIAS DE MASSAMÁ E MONTE ABRAÃO
#> 102 UNIÃO DAS FREGUESIAS DE MAXIAL E MONTE REDONDO
#> 103 UNIÃO DAS FREGUESIAS DE MIRAGAIA E MARTELEIRA
#> 104 UNIÃO DAS FREGUESIAS DE MOSCAVIDE E PORTELA
#> 105 UNIÃO DAS FREGUESIAS DE OEIRAS E SÃO JULIÃO DA BARRA, PAÇO DE ARCOS E CAXIAS
#> 106 UNIÃO DAS FREGUESIAS DE PAINHO E FIGUEIROS
#> 107 UNIÃO DAS FREGUESIAS DE PONTINHA E FAMÕES
#> 108 UNIÃO DAS FREGUESIAS DE PÓVOA DE SANTA IRIA E FORTE DA CASA
#> 109 UNIÃO DAS FREGUESIAS DE PÓVOA DE SANTO ADRIÃO E OLIVAL BASTO
#> 110 UNIÃO DAS FREGUESIAS DE QUELUZ E BELAS
#> 111 UNIÃO DAS FREGUESIAS DE RAMADA E CANEÇAS
#> 112 UNIÃO DAS FREGUESIAS DE RIBAFRIA E PEREIRO DE PALHACANA
#> 113 UNIÃO DAS FREGUESIAS DE SACAVÉM E PRIOR VELHO
#> 114 UNIÃO DAS FREGUESIAS DE SANTA IRIA DE AZOIA, SÃO JOÃO DA TALHA E BOBADELA
#> 115 UNIÃO DAS FREGUESIAS DE SANTO ANTÃO E SÃO JULIÃO DO TOJAL
#> 116 UNIÃO DAS FREGUESIAS DE SANTO ANTÓNIO DOS CAVALEIROS E FRIELAS
#> 117 UNIÃO DAS FREGUESIAS DE SINTRA (SANTA MARIA E SÃO MIGUEL, SÃO MARTINHO E SÃO PEDRO DE PENAFERRIM)
#> 118 UNIÃO DAS FREGUESIAS DE SÃO BARTOLOMEU DOS GALEGOS E MOLEDO
#> 119 UNIÃO DAS FREGUESIAS DE SÃO JOÃO DAS LAMPAS E TERRUGEM
#> 120 UNIÃO DAS FREGUESIAS DE VENDA DO PINHEIRO E SANTO ESTÊVÃO DAS GALÉS
#> 121 UNIÃO DAS FREGUESIAS DO CACÉM E SÃO MARCOS
#> 122 UNIÃO DAS FREGUESIAS DO CADAVAL E PÊRO MONIZ
#> 123 VALE DO PARAÍSO
#> 124 VENTEIRA
#> 125 VENTOSA
#> 126 VERMELHA
#> 127 VIALONGA
#> 128 VILA FRANCA DE XIRA
#> 129 VILA NOVA DA RAINHA
#> 130 VILA VERDE DOS FRANCOS
#> 131 VILAR
#> 132 VIMEIRO
#> 133 ÁGUAS LIVRES
# Geocode and reverse geocode with sf objects
# Structured search
struct <- gisco_addressapi_search(
country = "ES", city = "BARCELONA",
road = "GRACIA"
)
struct
#> Simple feature collection with 356 features and 13 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 2.149583 ymin: 41.38821 xmax: 2.170311 ymax: 41.41935
#> Geodetic CRS: WGS 84
#> First 10 features:
#> LD TF L2 L1 L0 PC N0 N1 N2 N3
#> 1 91 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 2 93 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 3 103 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 4 101 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 5 105 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 6 107 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 7 99 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 8 97 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 9 96 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 10 94 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> OL X Y geometry
#> 1 8FH495V6+WCV 2.161046 41.39487 POINT (2.161046 41.39487)
#> 2 8FH495V6+X9R 2.160902 41.39499 POINT (2.160902 41.39499)
#> 3 8FH495W5+7XW 2.159969 41.39574 POINT (2.159969 41.39574)
#> 4 8FH495W6+727 2.160050 41.39567 POINT (2.16005 41.39567)
#> 5 8FH495W5+9W3 2.159792 41.39588 POINT (2.159792 41.39588)
#> 6 8FH495W5+CRJ 2.159529 41.39610 POINT (2.159529 41.3961)
#> 7 8FH495W6+45H 2.160484 41.39532 POINT (2.160484 41.39532)
#> 8 8FH495W6+36W 2.160582 41.39524 POINT (2.160582 41.39524)
#> 9 8FH495W6+5GP 2.161332 41.39545 POINT (2.161332 41.39545)
#> 10 8FH495W6+4HW 2.161452 41.39535 POINT (2.161452 41.39535)
# Reverse geocoding
reverse <- gisco_addressapi_reverse(x = struct$X[1], y = struct$Y[1])
reverse
#> Simple feature collection with 5 features and 13 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 2.160902 ymin: 41.39446 xmax: 2.161126 ymax: 41.39499
#> Geodetic CRS: WGS 84
#> LD TF L2 L1 L0 PC N0 N1 N2 N3
#> 1 91 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 2 89 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 3 93 PS GRACIA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 4 257 CL PROVENÇA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> 5 255 CL PROVENÇA BARCELONA CATALUÑA/CATALUNYA ES 8008 ES ES5 ES51 ES511
#> OL X Y geometry
#> 1 8FH495V6+WCV 2.161046 41.39487 POINT (2.161046 41.39487)
#> 2 8FH495V6+WFC 2.161126 41.39480 POINT (2.161126 41.3948)
#> 3 8FH495V6+X9R 2.160902 41.39499 POINT (2.160902 41.39499)
#> 4 8FH495V6+RC2 2.161020 41.39451 POINT (2.16102 41.39451)
#> 5 8FH495V6+Q9P 2.160950 41.39446 POINT (2.16095 41.39446)
# }