You really need a download manager for files over 250MB. Your ISP [or anyone else on the route from your data to you] is likely to start caching data... not always correctly.
Your browser may be to blame - it would be simple enough to test another - but a download manager will stand you in good stead for many things. Lots of them have plugins to intercept browser downloads, so you don't forget & get a broken file.This is the advice section from an online service I use...
Personally, I've never tried their recommendation of ReGet - I'm on Mac & ReGet is Win-only software. As for PKZip - I've never had a broken zip file since I started using download managersDownloading large files over HTTP on the Internet can be tricky. To avoid the frustration of broken or corrupt downloads, observe the following suggestions when downloading from the Zip Manager: Never download any zip file or zip segment that is greater than 255 Megabytes (MB) in size. If your zip file is greater than 255 MB, use a download manager to split the download into multiple parts.
This is a limitation of broken, or misconfigured, web cache servers operated by your ISP. These cache servers behave in unexpected ways when transferring files greater than 255 MB in size. They can induce corruption, or premature session termination.
The cache servers are usually transparent. You can't tell they are in place until they corrupt a download.
Use a download manager when ever possible. Avoid downloading large zips with your web browser. Configure your download manager to split your download into numerous parts. Make sure that each download segment is less than 255 MB. For example, if your zip file is 800 MB in size, you need to split the download into 4 parts. The download manager will automatically combine the parts into one whole file.
Not only does using a download manager increase reliability of downloading large files over the Internet, they also increase your download speed.
We recommend ReGet as a download manager. ReGet supports SSL as well.
Do not try to resume a download on a different port then the download was started on. Your computer thinks that identical files on different ports are different files. If you switch ports, instead of resuming the file, your computer will start the download from the beginning.
If you must use a web browser to download from the Zip Manager, make sure the browser's cache is set to at least twice the size of the largest zip file you plan to download. If you are using IE, make sure to check both checkboxes under Tools|Internet Options|Advanced|HTTP 1.1 settings. You will have to restart your browser for these changes to take effect.
Make sure you have the newest firmware in your cable/dsl router. This is especially important for linksys routers. Older firmware versions contained incorrect MTU values that caused corruption at high speeds.
If you are unlucky enough to get a corrupt or broken zip file, use PKZip to repair the zip and recover as many files as possible. PKZip has the best repair algorithms compared to other utilities.
I have find the following way to solve this problem in GEE (1) First Export your GEE NDVI Layer as Raster Tiff in your Google Drive using this code below:
Export.image.toDrive({
image: NdviData,
description: 'DGKhanDivCo',
folder:'DGKhanDivCo',
scale: 05,
region: roi,
fileFormat: 'GeoTIFF',
maxPixels: 1e12,
});
(2) Download this Geotiff file from your Google Drive and make a Mosaic (If necessary) in Arc Map. Then Reclassify this raster according to your Bins.
(3) Convert this reclassify raster to polygon in Arcmap and then merge the polygons and calculate Area
In this way you can share Google Earth Engine calculated NDVI as Shapefile layer with your Colleagues. Any shortcut Idea will be appreciable
Here's a part of my code (cannot share all of it) that gets a list of urls and makes a copy on hard drive:
if (Download == TRUE) {
urls = DataFrame$productimagepath
for (url in urls) {
newName <- paste ("Academy/",basename(url), sep =" ")
download.file(url, destfile = newName, mode = "wb")
}
}
Got the clue
Use as on Windows, it seems to be needed e.g https://community.rstudio.com/t/download-file-issue-corrupted-file/60844/2download.file(url, file_path, quiet = TRUE, mode = "wb")
The required part is the optionmode = "wb"
Your issue is related to your OS. FYI, my R version is on Ubuntu 64 18.04. When I run the following on the OS I can confirm that diff from files retrieved through R method and wget is empty: it means both files have the exact same contentR scripting front-end version 3.6.3 (2020-02-29))
Rscript -e 'download.file("https://floodmap.modaps.eosdis.nasa.gov/Products/060W030S/2021/MSW_2021120_060W030S_A14x3D3OT.tif", "./MSW_2021120_060W030S_A14x3D3OT.tif")'
wget -O wget_MSW_2021120_060W030S_A14x3D3OT.tif https://floodmap.modaps.eosdis.nasa.gov/Products/060W030S/2021/MSW_2021120_060W030S_A14x3D3OT.tif
diff wget_MSW_2021120_060W030S_A14x3D3OT.tif MSW_2021120_060W030S_A14x3D3OT.tif
It looks like your not resting the memory stream. Try moving into the foreach.var jetStream = new System.IO.MemoryStream();
if (files != null && files.Count > 0)
{
foreach (var file in files)
{
var jetStream = new System.IO.MemoryStream();
Console.WriteLine("{0} ({1})", file.Name, file.Id);
FilesResource.GetRequest request = new FilesResource.GetRequest(service, file.Id);
//ExportRequest(service, file.Id, "application/vnd.google-apps.file");
//(service, file.Id);
string pathforfiles = path + file.Name.ToString();
request.MediaDownloader.ProgressChanged += (Google.Apis.Download.IDownloadProgress progress) =>
{
switch (progress.Status)
{
case Google.Apis.Download.DownloadStatus.Downloading:
{
Console.WriteLine(progress.BytesDownloaded);
break;
}
case Google.Apis.Download.DownloadStatus.Completed:
{
Console.WriteLine("Download complete.");
using (System.IO.FileStream file = new System.IO.FileStream(pathforfiles, System.IO.FileMode.Create, System.IO.FileAccess.Write))
{
jetStream.WriteTo(file);
}
break;
}
case Google.Apis.Download.DownloadStatus.Failed:
{
Console.WriteLine("Download failed.");
break;
}
}
};
request.DownloadWithStatus(jetStream);
}
}