Skip to content

Commit

Permalink
deleted cadastral functions and data
Browse files Browse the repository at this point in the history
  • Loading branch information
verajosemanuel committed Dec 14, 2017
1 parent 8b30ac3 commit a101cc1
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 358 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
21 changes: 7 additions & 14 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
Package: spanish
Type: Package
Title: Misc Functions for Spanish Data
Version: 0.2.0
Date: 2017-07-01
Author: person( "Jose Manuel","Vera Oteo", email = "[email protected]",
role = c("aut","cre")
Title: Translate Quantities from Strings Spelled in Spanish to Integer
Version: 0.3.0
Date: 2017-12-14
Authors@R: person( "Jose Manuel","Vera Oteo", email = "[email protected]",
role = c("aut","cre"))
URL: https://github.com/verajosemanuel
BugReports: https://github.com/verajosemanuel/spanish/issues
Maintainer: Jose M. Vera <[email protected]>
Depends: magrittr, xml2
Description: Character vector to numerical translation in Euros from spanish
Description: Character vector to numerical translation in Euros from Spanish
spelled monetary quantities. Text must be previously cleaned & removed
extraneous words, symbols or cents. Quantities MUST be written in a correct
Spanish cause this isn't a grammar tool. Upper limit is up to the millions
range.
Geocoding from cadastral reference number. Source data must be a valid
cadastral reference or downloaded KML files from cadastral website.
Be careful geocoding. You will be banned if many request
are issued in a short period of time. geocode_cadastral() waits 2 seconds
between requests.
range.
License: GPL-3
Encoding: UTF-8
LazyData: true
Collate:
'geocode_cadastral.R'
'to_number.R'
'cadastral_references-data.R'
'cantidades-data.R'
'spanish.R'
RoxygenNote: 6.0.1.9000
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

import(magrittr)
import(xml2)
export(geocode_cadastral)
export(to_number)
45 changes: 0 additions & 45 deletions R/cadastral_references-data.R

This file was deleted.

90 changes: 0 additions & 90 deletions R/geocode_cadastral.R

This file was deleted.

7 changes: 0 additions & 7 deletions R/spanish.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
#' The upper limit is up to the millions range. Cents must be removed.
#' (in my TODO list to parse cents part)
#'
#' @section geocode_cadastral():
#' Geocode by longitude and latitude from cadastral references.
#' Get longitude/latitude from valid cadastral ref. or kml files from catastro.
#'
#' @section Warning: You may be banned if many requests in short time are made
#' to catastro. Please be warned.
#'
#' @docType package
#' @name spanish
NULL
20 changes: 0 additions & 20 deletions R/zzz.R

This file was deleted.

66 changes: 0 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,76 +34,10 @@ head(cantidades[ , c("var2","var3")])
6 dosmil cuarenta 2040
```

### geocode_cadastral() ###
**geocode_cadastral** obtains longitude/latitude from valid cadastral references or kml files from catastro.

```
geocode_cadastral("0636105UF3403N", parse_files = FALSE)
[1] "36.5209422288168,-4.89298751473745"
```

Use lapply to geocode cadastral references from dataframe columns.

```
cadastral_references$new <- lapply(cadastral_references$cadref1, geocode_cadastral)
cadastral_references
cadref1 cadref2 new
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
```

separate generated geocode "new" into columns (lon/lat) usign tidyr

```
library(tidyr)
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
```

When folder is source. We may process each kml the same way as remote URL.

```
files <- list.files("folder", full.names = T)
for (f in files) {
coords <- geocode_cadastral(f, parse_files = TRUE)
df <- as.data.frame(rbind(df , as.data.frame(coords, stringsAsFactors = F )))
}
```

separate lat/lon into columns the same as before

```
df <- tidyr::separate(coords, into = c("longitude","latitude"), sep = "," )
```


### Requirements:
- magrittr must be installed.
- to_number() needs clean text. So it must be previously cleaned & removed extraneous words, symbols or cents.
- Quantities MUST be written in a correct Spanish (this is not a grammar tool).
- The upper limit is up to the millions range.
- geocode_cadastral() requests to catastro website.

# BE WARNED: You'll be banned if many requests to catastro are made in short time. #
- Because of that geocode_cadastral() waits two seconds between requests.
Binary file removed data/cadastral_references.RData
Binary file not shown.
49 changes: 0 additions & 49 deletions man/cadastral_references.Rd

This file was deleted.

Loading

0 comments on commit a101cc1

Please sign in to comment.