Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbec399e

Browse files
committed
small clean up, update to new USAboundaries call. Fixs#18
1 parent6e8f4a8 commitbec399e

File tree

12 files changed

+48
-93
lines changed

12 files changed

+48
-93
lines changed

‎.travis.yml‎

Lines changed: 0 additions & 45 deletions
This file was deleted.

‎DESCRIPTION‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Suggests:
2929
License: MIT + file LICENSE
3030
Encoding: UTF-8
3131
LazyData: true
32-
RoxygenNote: 7.1.1
32+
RoxygenNote: 7.1.2
3333
URL: https://github.com/mikejohnson51/AOI/

‎NAMESPACE‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export(getClip)
1818
export(getFiat)
1919
export(list_states)
2020
import(leaflet)
21-
importFrom(USAboundaries,us_boundaries)
2221
importFrom(USAboundaries,us_counties)
22+
importFrom(USAboundaries,us_states)
2323
importFrom(USAboundaries,us_zipcodes)
2424
importFrom(dplyr,bind_rows)
2525
importFrom(dplyr,mutate)
@@ -46,6 +46,7 @@ importFrom(sf,st_as_sf)
4646
importFrom(sf,st_bbox)
4747
importFrom(sf,st_buffer)
4848
importFrom(sf,st_cast)
49+
importFrom(sf,st_coordinates)
4950
importFrom(sf,st_crs)
5051
importFrom(sf,st_geometry_type)
5152
importFrom(sf,st_intersection)

‎R/bbox_functions.R‎

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,15 @@ bbox_get <- function(x) {
1515
c(xmin=x[1],xmax=x[2],ymin=x[3],ymax=x[4]),
1616
crs=sf::st_crs(4326)
1717
)
18-
}
19-
20-
if (methods::is(x,"numeric")) {
18+
}elseif (methods::is(x,"numeric")) {
2119
x<-sf::st_bbox(
2220
c(xmin=x[1],xmax=x[2],ymin=x[3],ymax=x[4]),
2321
crs=sf::st_crs(4326)
2422
)
25-
}
26-
27-
if (methods::is(x,"Spatial")) {
28-
x<-sf::st_bbox(x,crs=x@crs)
29-
}
30-
31-
if (methods::is(x,"Raster")) {
32-
x<-sf::st_bbox(x,crs=x@crs)
33-
}
34-
if (methods::is(x,"sf")) {
35-
x<-sf::st_bbox(x,crs=sf::st_crs(x))
23+
}else {
24+
x<- suppressWarnings({
25+
sf::st_bbox(x,crs=sf::st_crs(x))
26+
})
3627
}
3728

3829
sf::st_sf(sf::st_as_sfc(x))
@@ -47,11 +38,11 @@ bbox_get <- function(x) {
4738
#' @export
4839

4940
bbox_coords<-function(x) {
50-
bb<-sf::st_bbox(x)
51-
df<-data.frame(
52-
xmin=bb[1],ymin=bb[2],
53-
xmax=bb[3],ymax=bb[4],
54-
row.names=NULL
55-
)
56-
return(df)
41+
bb<-suppressWarnings({sf::st_bbox(x) })
42+
#df <- data.frame(
43+
# xmin = bb[1], ymin = bb[2],
44+
# xmax = bb[3], ymax = bb[4],
45+
# row.names = NULL
46+
#)
47+
return(bb)
5748
}

‎R/getClip.R‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
getClip<-function(x,km=FALSE) {
2424
fin<- defineClip(x,km=km)
2525
location<-fin$location
26-
origin<-fin$o
26+
origin<-fin$o
2727

2828
if (all(is.null(fin$h), is.null(fin$w), is.null(origin))) {
2929
poly<- geocode(location,bb=TRUE,full=FALSE)

‎R/internals.R‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#' @description
33
#' Geocode via Open Street Maps API. \code{geocodeOSM}
44
#' takes an input string and converts it to a geolocation.
5-
#'Addtionally it can return the location as a simple
6-
#' features point and theminimun bounding area
5+
#'Additionally it can return the location as a simple
6+
#' features point and theminimum bounding area
77
#' of the location extent.
88
#' @param location a place name
99
#' @param pt if TRUE a simple feature point is appended to returned list
@@ -23,6 +23,7 @@
2323
#'
2424
geocodeOSM<-function(location,pt=FALSE,bb=FALSE,
2525
all=FALSE,full=FALSE) {
26+
2627
if (sum(pt,bb,all)>1) {
2728
stop("Only pt, bb, or all can be TRUE. Leave others as FALSE")
2829
}
@@ -44,6 +45,7 @@ geocodeOSM <- function(location, pt = FALSE, bb = FALSE,
4445
)
4546

4647
ret<-jsonlite::fromJSON(URL[1])
48+
4749
rownames(ret)<-NULL
4850

4951
if (length(ret)!=0) {
@@ -80,7 +82,7 @@ geocodeOSM <- function(location, pt = FALSE, bb = FALSE,
8082

8183
point<-sf::st_as_sf(x=coords,coords= c("lon","lat"),crs=4269)
8284
tmp.bb<- unlist(s$boundingbox)
83-
bbs<- bbox_get(paste(tmp.bb[3],tmp.bb[4],tmp.bb[1],tmp.bb[2],sep=","))
85+
bbs<- bbox_get(x=paste(tmp.bb[3],tmp.bb[4],tmp.bb[1],tmp.bb[2],sep=","))
8486
bbs$request<-s$request
8587
bbs<-if (full) {
8688
merge(bbs,s)

‎R/package_AOI.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@
3232
#' @import leaflet
3333
#' @importFrom dplyr select mutate bind_rows
3434
#' @importFrom jsonlite fromJSON
35-
#' @importFrom sf st_as_sf st_sf as_Spatial st_bbox st_transform st_sfc st_polygon st_crs st_geometry_type st_buffer st_intersection
35+
#' @importFrom sf st_as_sf st_sf as_Spatial st_bbox st_transform st_sfc st_polygon st_crs st_geometry_type st_buffer st_intersection st_coordinates
3636
#' @importFrom rvest html_nodes html_text html_attr html_table
3737
#' @importFrom xml2 read_html
3838
#' @importFrom stats complete.cases na.omit setNames
3939
#' @importFrom utils globalVariables
4040
#' @importFrom rnaturalearth ne_countries
41-
#' @importFrom USAboundariesus_boundaries us_counties us_zipcodes
41+
#' @importFrom USAboundariesus_states us_counties us_zipcodes
4242
#' @importFrom methods is
4343

4444
NULL

‎README.Rmd‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ library(AOI)
1818

1919
#AOI <imgsrc="man/figures/logo.png"width=130height =150align="right" />
2020

21-
[![Build Status][image-1]][1]
22-
[![R-CMD-check][image-4]][4]
23-
[![Coverage Status][image-2]][2]
24-
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.][image-5]][5]
25-
[![DOI][image-3]][3]
21+
<!-- badges: start-->
22+
[![DOI](https://zenodo.org/badge/158620263.svg)](https://zenodo.org/badge/latestdoi/158620263)
23+
[![R CMD Check](https://github.com/mikejohnson51/AOI/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mikejohnson51/AOI/actions/workflows/R-CMD-check.yaml)
24+
[![Dependencies](https://img.shields.io/badge/dependencies-8/18-orange?style=flat)](#)
25+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://choosealicense.com/licenses/mit/)
26+
[![Project Status: Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
27+
[![LifeCycle](man/figures/lifecycle/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
28+
<!-- badges: end-->
2629

2730
The purpose of AOI is to help people create reproducible, programmatic, boundaries for analysis and mapping workflows. The package targets five main use cases:
2831

‎README.md‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33

44
#AOI <imgsrc="man/figures/logo.png"width=130height =150align="right" />
55

6-
[![Build
7-
Status](https://travis-ci.org/mikejohnson51/AOI.svg?branch=master)](https://travis-ci.org/mikejohnson51/AOI)
8-
[![R-CMD-check](https://github.com/mikejohnson51/AOI/workflows/R-CMD-check/badge.svg)](https://github.com/mikejohnson51/AOI/actions)
9-
[![Coverage
10-
Status](https://img.shields.io/coveralls/github/mikejohnson51/AOI.svg)](https://coveralls.io/r/mikejohnson51/AOI?branch=master)
11-
[![Project Status: Active – The project has reached a stable, usable
12-
state and is being actively
13-
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
14-
[![DOI](https://zenodo.org/badge/139353238.svg)](https://zenodo.org/badge/latestdoi/139353238)
6+
<!-- badges: start-->
7+
8+
[![DOI](https://zenodo.org/badge/158620263.svg)](https://zenodo.org/badge/latestdoi/158620263)
9+
[![R CMD
10+
Check](https://github.com/mikejohnson51/AOI/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/mikejohnson51/AOI/actions/workflows/R-CMD-check.yaml)
11+
[![Dependencies](https://img.shields.io/badge/dependencies-8/18-orange?style=flat)](#)
12+
[![License:
13+
MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://choosealicense.com/licenses/mit/)
14+
[![Project Status:
15+
Active](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
16+
[![LifeCycle](man/figures/lifecycle/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
17+
<!-- badges: end-->
1518

1619
The purpose of AOI is to help people create reproducible, programmatic,
1720
boundaries for analysis and mapping workflows. The package targets five

‎man/geocodeOSM.Rd‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp