Skip to content

Commit

Permalink
drop supportting for R versions below 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
womeimingzi11 committed Oct 31, 2023
1 parent 5bb0f09 commit c3d5784
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 50 deletions.
8 changes: 3 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: amapGeocode
Title: An Interface to the 'AutoNavi Maps' API Geocoding Services
Version: 0.6.0
Version: 0.7.0
Authors@R:
c(person(given = "Han",
family = "Chen",
Expand All @@ -13,11 +13,9 @@ Authors@R:
email = "243016042@qq.com"))
Description: Getting and parsing data of location geocode/reverse-geocode and administrative regions from 'AutoNavi Maps'<https://lbs.amap.com/api/webservice/summary> API.
License: MIT + file LICENSE
Depends: R (>= 3.5)
Depends: R (>= 4.1.0)
Imports:
httr,
jsonlite,
magrittr,
sjmisc,
stats,
xml2,
Expand All @@ -33,7 +31,7 @@ Suggests:
VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.1.1
RoxygenNote: 7.2.3
Language: en-US
URL: https://github.com/womeimingzi11/amapGeocode
BugReports: https://github.com/womeimingzi11/amapGeocode/issues
2 changes: 0 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export(convertCoord)
export(extractAdmin)
export(extractConvertCoord)
Expand All @@ -9,4 +8,3 @@ export(extractLocation)
export(getAdmin)
export(getCoord)
export(getLocation)
importFrom(magrittr,"%>%")
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# amapGeocode 0.7.0
* Since 0.7.0, the Version of R under 4.1.0 will not support anymore.

# amapGeocode 0.6.0
* Improve the implement of parallel requests
* Replace `parallel` with `future`
Expand Down
8 changes: 4 additions & 4 deletions R/getAdmin.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ getAdmin.individual <-
#' # or set by key argument in `getAdmin()`
#'
#' # Get subordinate administrative regions as a XML
#' getAdmin("Sichuan Province", output = "XML") %>%
#' getAdmin("Sichuan Province", output = "XML") |>
#' # extract subordinate administrative regions as a data.table
#' extractAdmin()
#' }
Expand Down Expand Up @@ -342,16 +342,16 @@ extractAdmin <- function(res) {
ls_var <-
lapply(var_name, function(var_n) {
ifelse(sjmisc::is_empty(district[[var_n]]), NA, district[[var_n]])
}) %>%
as.data.frame() %>%
}) |>
as.data.frame() |>
stats::setNames(var_name)
# assemble information and coordinate
data.table::data.table(
lng = location_in_coord[[1]],
lat = location_in_coord[[2]],
ls_var
)
}) %>%
}) |>
data.table::rbindlist()
} else {
"Not support current extraction task."
Expand Down
6 changes: 3 additions & 3 deletions R/getCoord.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ getCoord.individual <-
#' # or set by key argument in `getCoord()`
#'
#' # Get geocode as a XML
#' getCoord("IFS Chengdu", output = "XML") %>%
#' getCoord("IFS Chengdu", output = "XML") |>
#' # extract geocode regions as a data.table
#' extractCoord()
#' }
Expand Down Expand Up @@ -312,14 +312,14 @@ extractCoord <- function(res) {
function(x) {
x <- ifelse(sjmisc::is_empty(geocode[[x]]), NA, geocode[[x]])
}
) %>%
) |>
as.data.frame()

data.table::data.table(
lng = location_in_coord[[1]],
lat = location_in_coord[[2]],
ls_var
) %>%
) |>
# set name of
stats::setNames(c("lng", "lat", var_name))
}
Expand Down
7 changes: 4 additions & 3 deletions R/getLocation.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ getLocation.individual <-
#' # the token should be set by `option(amap_key = 'key')`
#' # or set by key argument in `getLocation()`
#' # Get reverse-geocode as a XML
#' getLocation(104.043284, 30.666864, output = "XML") %>%
#' getLocation(104.043284, 30.666864, output = "XML") |>
#' # extract reverse-geocode regions as a table
#' extractLocation()
#' }
Expand Down Expand Up @@ -366,12 +366,13 @@ extractLocation <- function(res) {
addressComponent[[x]]
)
}
) %>%
) |>
as.data.frame()

data.table::data.table(
formatted_address = regeocode$formatted_address[[1]],
ls_var
) %>%
) |>
# set name of table
stats::setNames(c("formatted_address", var_name))
}
Expand Down
11 changes: 0 additions & 11 deletions R/utils-pipe.R

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ res <- getLocation(103.996, 30.6475)
knitr::kable(res)
```

| formatted_address | country | province | city | district | township | citycode | towncode |
|:-----------------------------------------------------------------------------|:--------|:---------|:-------|:---------|:---------|:---------|:-------------|
| 四川省成都市武侯区晋阳街道八二小区抄手(金楠天街店)龙湖金楠天街·C馆(天街里店) | 中国 | 四川省 | 成都市 | 武侯区 | 晋阳街道 | 028 | 510107011000 |
| formatted_address | country | province | city | district | township | citycode | towncode |
|:-------------------------------------------------------------------|:--------|:---------|:-------|:---------|:---------|:---------|:-------------|
| 四川省成都市武侯区晋阳街道晋吉西一街66号龙湖金楠天街·C馆(天街里店) | 中国 | 四川省 | 成都市 | 武侯区 | 晋阳街道 | 028 | 510107011000 |

`extractLocation` is created to get a result as a data.table.

Expand Down
2 changes: 2 additions & 0 deletions amapGeocode.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source

UseNativePipeOperator: Yes

QuitChildProcessesOnExit: Yes
2 changes: 1 addition & 1 deletion man/extractAdmin.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/extractCoord.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/extractLocation.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions man/pipe.Rd

This file was deleted.

8 changes: 4 additions & 4 deletions vignettes/Introduction_to_amapGeocode.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Then get result of geocoding, by `getCoord` function.
```r
library(amapGeocode)
res <-
getCoord('成都中医药大学')
getCoord('四川省博物馆')
knitr::kable(res)
```

Expand All @@ -46,7 +46,7 @@ If anyone want to get response as **JSON** or **XML**, just set `to_table = FALS

```r
res <-
getCoord('成都中医药大学', output = 'XML',to_table = FALSE)
getCoord('四川省博物馆', output = 'XML',to_table = FALSE)
res
```

Expand All @@ -70,7 +70,7 @@ knitr::kable(res)

```r
res <-
getLocation(104.043284, 30.666864, output = 'XML',to_table = FALSE)
getLocation(104.0339, 30.66069, output = 'XML',to_table = FALSE)
res
```

Expand Down Expand Up @@ -113,7 +113,7 @@ get result of reverse geocoding, by `convertCoord` function, here is how to conv

```r
res <-
convertCoord('116.481499,39.990475',coordsys = 'gps')
convertCoord("103.9960,30.6475", coordsys = "gps")
knitr::kable(res)
```

Expand Down

0 comments on commit c3d5784

Please sign in to comment.