Randomly selected data from catastro to test geocode_cadastral function

data(cadastral_references)

Format

A data frame.

Source

Sede Electrónica del Catastro

References

Catastro. Ministerio de Hacienda y función pública. (Catastro)

Examples

## source is cadastral reference number ## geocode_cadastral("0636105UF3403N", parse_files = FALSE)
#> [1] "-4.89298801318968,36.5209327812963"
## Use lapply to geocode cadastral references from dataframe columns. cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral) ## separate previously generated "new" data into columns usign tidyr library(tidyr)
#> Warning: package 'tidyr' was built under R version 3.5.2
#> #> Attaching package: 'tidyr'
#> The following object is masked from 'package:magrittr': #> #> extract
separate(cadastral_references, new, into = c('longitude','latitude'), sep = "," )
#> cadref1 cadref2 longitude latitude #> 1 2614501VK6621S 1449804NH1014N -3.44129716598736 40.3007548071216 #> 2 2715807VK6621S 3880109CD6038S -3.44034755388475 40.3008975152619 #> 3 2744702DF3824D 9501722DD6890B 2.19479121426678 41.4065056978248 #> 4 0944328DF3804D 1617647TF8611F 2.17206636096108 41.4071068008502 #> 5 8742806DF2884B 7893306CS7479S 2.14651391794721 41.4046077850113 #> 6 9314903NH3591C 9701703XG8890B -8.51948430067999 42.9131469314961
## source is folder. A loop is needed to process each kml file ##
# NOT RUN { files <- list.files("folder", full.names = T) for (f in files) { coords <- geocode_cadastral(f, parse_files = TRUE) d <- as.data.frame(rbind(d , as.data.frame(coords, stringsAsFactors = F ))) } # separate lat/lon into columns if you prefer using tidyr d <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," ) # }