Closed spencer-tassone closed 1 year ago
This is not an issue for lakes only but (likely) all data to be downloaded via ne_download()
. At least I see the same error for multiple data sets including countries, airports and more:
cannot open URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip': HTTP status was '404 Not Found'
cannot open URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/cultural/ne_110m_airports.zip': HTTP status was '404 Not Found'
I had the same issue this morning. Is there a workaround at all? I plan to use this package for teaching geospatial data visualisation next week [09/01/23].
I confirm the same bug on my platform (I was about to open an issue, but then saw it already existed). It seems something trivial to fix, but at the same time, is there any workaround once the zip folder has been downloaded locally? I am really stuck now.
You can install the version from ropensci/rnaturalearth. It will work.
You can install the version from ropensci/rnaturalearth. It will work.
I cannot confirm the code from my original comment is working again. I am still getting the same error message as described in the original comment.
I can confirm that your code works on my side:
rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf")
trying URL 'https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_lakes.zip'
Content type 'application/zip' length 23622 bytes (23 KB)
==================================================
downloaded 23 KB
OGR data source with driver: ESRI Shapefile
Source: "/tmp/Rtmp3j7riO", layer: "ne_110m_lakes"
with 24 features
It has 37 fields
Integer64 fields read as strings: scalerank ne_id
Simple feature collection with 24 features and 37 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: -124.9536 ymin: -16.53641 xmax: 109.9298 ymax: 66.9693
Geodetic CRS: WGS 84
When I try
rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf")
I get the same error message as described in the first post
trying URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip'
Error in utils::download.file(file.path(address), zip_file <- tempfile()) :
cannot open URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip'
In addition: Warning message:
In utils::download.file(file.path(address), zip_file <- tempfile()) :
cannot open URL 'https://www.naturalearthdata.com/http/www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip': HTTP status was '404 Not Found'
I can confirm that your code works on my side:
rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf") trying URL 'https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_lakes.zip' Content type 'application/zip' length 23622 bytes (23 KB) ================================================== downloaded 23 KB OGR data source with driver: ESRI Shapefile Source: "/tmp/Rtmp3j7riO", layer: "ne_110m_lakes" with 24 features It has 37 fields Integer64 fields read as strings: scalerank ne_id Simple feature collection with 24 features and 37 fields Geometry type: POLYGON Dimension: XY Bounding box: xmin: -124.9536 ymin: -16.53641 xmax: 109.9298 ymax: 66.9693 Geodetic CRS: WGS 84
It is unclear to me why/how your machine defaults to an amazon web services (aws) site when downloading the data, while mine tries the naturalearthdata.com website. Are you using any different packages?
Check my earlier message about installation. If you have installed as I said, you will have to restart R.
You can install the version from ropensci/rnaturalearth. It will work.
It is unclear what you mean by "the version". I have tried re-installing rnaturalearth but that has not fixed the issue.
install.packages("rnaturalearth")
library(rnaturalearth)
rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf")
trying URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip'
Error in utils::download.file(file.path(address), zip_file <- tempfile()) :
cannot open URL 'http://www.naturalearthdata.com/http//www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip'
In addition: Warning message:
In utils::download.file(file.path(address), zip_file <- tempfile()) :
cannot open URL 'https://www.naturalearthdata.com/http/www.naturalearthdata.com/download/110m/physical/ne_110m_lakes.zip': HTTP status was '404 Not Found'
@spencer-tassone, you need to install the developement version:
remotes::install_github("ropensci/rnaturalearth")
@spencer-tassone it just worked for me and I took these steps:
devtools::install_github("ropensci/rnaturalearth")
require("rnaturalearth")
rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf")
and make sure you have rnaturalearth::
- it didn't work for me without thisGreat it just worked for me too, thanks all!
@spencer-tassone it just worked for me and I took these steps:
1. Uninstall rnaturalearth 2. Restart R 3. `devtools::install_github("ropensci/rnaturalearth")` 4. `require("rnaturalearth")` 5. run `rnaturalearth::ne_download(scale = 110, type = 'lakes', category = 'physical', returnclass = "sf")` and make sure you have `rnaturalhearth::` - it didn't work for me without this
This was very clear and helpful advice, thank you! Also there is a small typo in number 5; in the second rnaturalearth
there is an extra h.
Hi @haleyoleynik, the namespace (the double colon) shouldn't be necessary once you have loaded the package. It is good practice to use library()
for that and not require()
but none of them should require an explicit reference to the package, strange. For me, it works without the namespace so make sure you're package is truly loaded.
I am trying to open the 110 m geometry of lakes for the whole world and am getting an
HTTP Error 404 Not Found
message due to what I think is an incorrect file path.When I run this command:
I get this error
When I go to the naturalearthdata.com website and search
lakes
I can see the download link for the 110 m lakes, which has the following filepath:Which is a slightly different file path from what the command above is trying
Incorrect file paths that the command above is trying
The first incorrect file path is missing an
s
in the firsthttp
The second incorrect file path is missing a/
in the secondhttp/