Ah ha, its a file with no line endings. Count the lines, zero:
$ wc -l countrymasks.geojson
0 countrymasks.geojson
Although adding a line ending to the file still produces the error.
Hmm. Even running it through `json_pp` to get it on multiple lines
results in the error:
$ more countrymasks_pp.
Interestingly, what seems to works is
readLines('countrymasks.geojson') |> st_read() -> r
with a warning:
Warning message:
In readLines("countrymasks.geojson") :
incomplete final line found on 'countrymasks.geojson'
On 29/11/2022 00:58, Miluji Sb wrote:
Thank you. I will report this bug (I
Thank you. I will report this bug (I did not have the confidence to call
this a bug before).
Even using your code, I get the same output.
structure(list(X = c(-67.3804401, -67.36091, -67.38058,
-67.339709998, -67.3780199, -67.32211), Y = c(-55.565569996,
-55.584009899,
This seems to be a weird bug in `st_read`. If you read it with an SQL
query that matches every row it works:
> js = st_read("./countrymasks.geojson", query="select * from countrymasks
> where 1 = 1")
Reading query `select * from countrymasks where 1 = 1' from data
source `/home/rowlings/Downloads
Thank you for reply. When I try using sf, I get the following error;
Error in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, :
attempt to set index 210/210 in SET_STRING_ELT.
Thanks again!
On Mon, Nov 28, 2022 at 1:50 PM Josiah Parry wrote:
> You're going to want to read the
You're going to want to read the file with sf.
Try object <- sf::st_read("~countrymasks.geojson")
On Mon, Nov 28, 2022 at 7:09 AM Miluji Sb wrote:
> Greetings everyone,
>
> I would like to convert the geojson file (
>
> https://drive.google.com/file/d/18h3sOjZg5jp5euLTWRi5mC40Sja8TZDN/view?usp=
Greetings everyone,
I would like to convert the geojson file (
https://drive.google.com/file/d/18h3sOjZg5jp5euLTWRi5mC40Sja8TZDN/view?usp=sharing)
to a dataframe - essentially obtain which has coordinates matched to a
country.
I have tried the following;
###
states <- geojsonsf::geojson_sf("~/co