-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: by
can't contain join column LINEARID
which is missing from LHS
#3
Comments
Hey, sorry for the delayed reply.
This suggest that the "roads" variable, which comes from the
tl_2018_[GEOID]_roads
shapfile, is lacking a column called "LINEARID", and so the join is
failing. If you take a look at it, is this the case? If you open up the
tl_2018_[GEOID]_roads.dbf file in Excel, does it contain a LINEARID column?
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Oct 3, 2019 at 8:59 AM Erik Goens ***@***.***> wrote:
I was able to run the Worldwide version, which is very cool, but the only
road detection I am seeing on the map is the interstates:
[image: image]
<https://user-images.githubusercontent.com/8153/66143479-10cd1980-e5bc-11e9-9632-d4db27b71eda.png>
So, I am attempting to run the UnitedStates version (after downloading all
the necessary feature names and road files) and I am running into the
following error:
➜ RoadColors git:(master) ✗ R -f UnitedStates.R
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin18.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(sf)
Linking to GEOS 3.7.2, GDAL 2.4.2, PROJ 6.2.0
> library(foreign)
> library(tidyverse)
── Attaching packages ─────────────────────────────────────── tidyverse 1.2.1 ──
✔ ggplot2 3.2.1 ✔ purrr 0.3.2
✔ tibble 2.1.3 ✔ dplyr 0.8.3
✔ tidyr 1.0.0 ✔ stringr 1.4.0
✔ readr 1.3.1 ✔ forcats 0.4.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
> library(lwgeom)
Linking to liblwgeom 2.5.0dev r16016, GEOS 3.7.2, PROJ 6.2.0
>
>
> options(stringsAsFactors = FALSE)
>
> #pt <- data.frame(lat = YOURLATHERE, long = YOURLONHERE)
> #city <- 'CITYNAMEHERE'
> #geoid <- c('GEOID1', 'GEOID2', 'GEOIDN')
>
> pt <- data.frame(lat = 39.7794476, long = -86.412935)
> city <- 'Indianapolis'
> geoid <- c('18097','18063','18011','18057','18059','18145','18081','18109')
>
> #-------import road files.----------
> files <- list.files(path="./FeatNames", pattern="*.dbf", full.names=TRUE, recursive=FALSE) %>% as.data.frame
> names(files) <- c("path")
> files$GEOID <- substr(files$path, 21, 25)
> files <- subset(files, GEOID %in% geoid)
>
> allroads <-NULL
>
> #----------combine em all and add suffixes--------------
> for (i in 1:nrow(files)) {
+ #read in the feature names file, which has road suffixes in it
+ featname <- read.dbf(files$path[i], as.is = TRUE)
+ featname$SUFTYPABRV[is.na(featname$SUFTYPABRV)] <- featname$PRETYPABRV[is.na(featname$SUFTYPABRV)]
+ featname <- featname %>% dplyr::select(LINEARID, SUFTYPABRV) %>% unique
+
+ #read in the roads shapefile as a simple features dataframe
+ roads <- read_sf("./Roads", paste0("tl_2018_", files$GEOID[i], "_roads"))
+ roads$len <- st_length(roads)
+
+ #join the two
+ temp <- inner_join(roads, featname, by = "LINEARID")
+
+ #merge em all
+ if (i==1) {
+ allroads <- temp
+ }else {
+ allroads <- do.call(rbind, list(temp, allroads))
+ }
+ }
Error: `by` can't contain join column `LINEARID` which is missing from LHS
Backtrace:
█
1. ├─dplyr::inner_join(roads, featname, by = "LINEARID")
2. ├─sf:::inner_join.sf(roads, featname, by = "LINEARID")
3. │ └─sf:::sf_join(NextMethod(), attr(x, "sf_column"), suffix[1])
4. │ └─sf_column %in% names(g)
5. ├─base::NextMethod()
6. └─dplyr:::inner_join.tbl_df(roads, featname, by = "LINEARID")
7. ├─dplyr::common_by(by, x, y)
8. └─dplyr:::common_by.character(by, x, y)
9. └─dplyr:::common_by.list(by, x, y)
10. └─dplyr:::bad_args(...)
11. └─dplyr:::glubort(fmt_args(args), ..., .envir = .envir)
I have the FeatNames and Roads folder in the same path as the UnitedStates
file:
➜ RoadColors git:(master) ✗ lsa
total 64
drwxr-xr-x 13 egoens staff 416B Oct 2 16:40 .
drwxr-xr-x@ 6 egoens staff 192B Oct 2 15:10 ..
-rw-r--r--@ 1 egoens staff 6.0K Oct 2 15:46 .DS_Store
drwxr-xr-x 12 egoens staff 384B Oct 3 08:53 .git
-rw-r--r-- 1 egoens staff 3.2K Oct 2 14:14 Canada.R
drwxr-xr-x 42 egoens staff 1.3K Oct 2 15:17 FeatNames
drwxr-xr-x 4 egoens staff 128B Oct 2 15:11 Indianapolis
-rw-r--r-- 1 egoens staff 1.1K Oct 2 14:14 README.md
drwxr-xr-x 51 egoens staff 1.6K Oct 2 15:17 Roads
-rw-r--r-- 1 egoens staff 5.1K Oct 2 15:37 UnitedStates.R
-rw-r--r-- 1 egoens staff 4.2K Oct 3 06:51 Worldwide.R
This is an amazing project and thanks for sharing. Any help would be
appreciated and thanks again.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3?email_source=notifications&email_token=AK43WPYJIN4EGD2BZU2RY3LQMYJHLA5CNFSM4I5FBEJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HPOIZRA>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AK43WP436PX7EEBYZS77VHTQMYJHLANCNFSM4I5FBEJQ>
.
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=icon>
Virus-free.
www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=link>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was able to run the Worldwide version, which is very cool, but the only road detection I am seeing on the map is the interstates:
So, I am attempting to run the UnitedStates version (after downloading all the necessary feature names and road files) and I am running into the following error:
I have the
FeatNames
andRoads
folder in the same path as theUnitedStates
file:This is an amazing project and thanks for sharing. Any help would be appreciated and thanks again.
The text was updated successfully, but these errors were encountered: