leaidr icon indicating copy to clipboard operation
leaidr copied to clipboard

Pulling the school districts-error

Open Kicsbr opened this issue 4 years ago • 7 comments

Hi, I am trying to pull a state shapefile and it seems that something is 'broken'. I found the website with the example of using leaidr package, and when I run the line it give this message:

tn <- lea_get("tn") trying URL 'https://github.com/datalorax/us-district-shapefiles/raw/master/individ-districts/47.dbf' Content type 'application/octet-stream' length 210592 bytes (205 KB) downloaded 205 KB

trying URL 'https://github.com/datalorax/us-district-shapefiles/raw/master/individ-districts/47.prj' Content type 'text/plain; charset=utf-8' length 147 bytes downloaded 147 bytes

trying URL 'https://github.com/datalorax/us-district-shapefiles/raw/master/individ-districts/47.shp' Content type 'application/octet-stream' length 7345380 bytes (7.0 MB) downloaded 7.0 MB

trying URL 'https://github.com/datalorax/us-district-shapefiles/raw/master/individ-districts/47.shx' Content type 'application/octet-stream' length 1364 bytes downloaded 1364 bytes

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Cannot open layer

I tried with other states, and it gives me the same error. Am I doing this correctly? I have installed all the pacakges that the Isabella's webiste asked, but still fails.

By the way, my project is a survey at the school districts in IA, and what you have here is exactly what I needed. I just cannot figure out what is wrong.

Thanks.

Ki

Kicsbr avatar Jul 01 '21 16:07 Kicsbr

Hello!

Thanks for writing. I am glad that you are interested in {leaidr} and sorry that you're running into issues.

Could you please let me know when you installed the package? It underwent some changes, and maybe that's why the lea_get() didn't work. Another thing is to make sure all the packages that {leaidr} depends on are updated, as well.

Here was how I was able to get the Iowa school districts:

devtools::install_github("ivelasq/leaidr", force = TRUE)

library(leaidr)

ia <- lea_get("ia")

ia %>% 
  sf::st_as_sf() %>% 
  ggplot2::ggplot() +
  ggplot2::geom_sf()

Let me know if reinstalling the package works! Thanks.

ivelasq avatar Jul 01 '21 16:07 ivelasq

I have installed it this morning and used the same exact same code and it is not working. However, it is possible that this is a fault on my end. My R 4.0. 3 and RStudio 1.4.1103 are the portable versions at the office, and these older versions may the culprit. I will install the R 4.1.0 and see if error persists. I was able to bring the SD map using your code from an early post, but I was trying to see if this newer version was better.

By the way, I would love to see if the package could combine the school districts as in "sf" package that allows simple feature (sf) objects to be dissolved into one. This is because in IA there are 9 area education agencies that groups close to 300 school districts, and some of the maps that I would like to make will be in these 9 regions. I am not a developer, so I have no clue how to do this, but if you need any input on what I mean for this, I will be more than happy to share.

Thank you for your prompt response and your time. Ki

Kicsbr avatar Jul 01 '21 17:07 Kicsbr

Hi there! Just following up - were you able to resolve the issue @Kicsbr ?

ivelasq avatar Jul 16 '21 05:07 ivelasq

Hi Isabella,

I just couldn't make it to work. This is because I am constrained to use the portable version of R and RStudio at the center. Some of the errors that I get are related to this portable version.

I am going to try to remote access my PC at home and test remotely the package itself to find out if the portable version is the culprit. Yet, I am in the midst of getting ready for the school survey (which will start in August), and I just did not find the right time.

Could I ask a question? this is the same one that I think I posted/emailed to you. In IA, the school districts are grouped in Area Educational Agencies (AEA), and wondering how I could group the school districts into these 9 regions. I found a package that just does that by merging the areas, deleting no-shared boundaries, and defining the one that overlaps as the new boundaries. Yet, this is something that I need to test later.

Thank you very much for following up on this. I found your website very useful and I appreciate that you share your knowledge and expertise.

Best. Ki

On Fri, Jul 16, 2021 at 12:32 AM Isabella Velásquez < @.***> wrote:

Hi there! Just following up - were you able to resolve the issue @Kicsbr https://github.com/Kicsbr ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ivelasq/leaidr/issues/10#issuecomment-881188921, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXGANZRYP27KFYICVBSGSLTX7AADANCNFSM47VB2ONA .

-- Ki H. Park, Ph.D.

Center for Social and Behavioral Research | University of Northern Iowa | www.uni.edu/csbr 2304 College Street, Cedar Falls, Iowa 50614-0402 phone: (319) 273-3114 | fax:(319) 273-3104 | @.***

Kicsbr avatar Jul 16 '21 11:07 Kicsbr

Hi there! Sorry to hear that it didn't end up working. I haven't tried grouping geographies before. What is the name of the package?

ivelasq avatar Jul 19 '21 01:07 ivelasq

Isabella, I don't think that this is the package problem, but rather it is on my end with my older version of portable versions. The package to 'merge' or dissolve boundaries is "sf" ( https://r-spatial.github.io/sf/reference/geos_combine.html ), and when I was reading the feature of this package, I thought that it could be used to aggregate school districts into an area agency (that contains about 30 school districts). This is still all ideas because I cannot make the package work, but I will come back later to address this issue. Thanks.

Ki

On Sun, Jul 18, 2021 at 8:30 PM Isabella Velásquez @.***> wrote:

Hi there! Sorry to hear that it didn't end up working. I haven't tried grouping geographies before. What is the name of the package?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ivelasq/leaidr/issues/10#issuecomment-882160181, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXGANYKO4CCAWWHH5DOYF3TYN53TANCNFSM47VB2ONA .

-- Ki H. Park, Ph.D.

Center for Social and Behavioral Research | University of Northern Iowa | www.uni.edu/csbr 2304 College Street, Cedar Falls, Iowa 50614-0402 phone: (319) 273-3114 | fax:(319) 273-3104 | @.***

Kicsbr avatar Jul 19 '21 12:07 Kicsbr

The package won't work for me either. Same issue.

Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
  Cannot open layer
In addition: Warning messages:
1: OGR support is provided by the sf and terra packages among others 
2: OGR support is provided by the sf and terra packages among others

I just installed your package, and I'm on the newest versions of R and RStudio. Not the portable ones either,

GameDungeon avatar Nov 24 '22 16:11 GameDungeon