neilcharles / geoviz

Functions to make it easy to process DEM data and add GPS traces to rstats Rayshader scenes, and to overlay mapbox and elevation shading imagery
http://www.hilltop-analytics.com
103 stars 11 forks source link

mosaic_uk_grid() produces an error when building Raster from OS Terrain 50 #1

Closed chris-billingham closed 5 years ago

chris-billingham commented 5 years ago

Hi there,

Great package, if I could just get it to run..

I've installed geoviz and downloaded the file: terr50_gagg_gb.zip from https://www.ordnancesurvey.co.uk/opendatadownload/products.html#TERR50 selecting ASCII GRID and GML (Grid) from the drop down.

When I point moasic_uk_grid() at the unzipped directory, after some time, I'm getting this error:

Error: vector memory exhausted (limit reached?)

I've tried it a few different times to no avail however.

Is this something you've seen before?

Thanks, Chris

neilcharles commented 5 years ago

I originally ran it on a laptop with 32GB of ram so it may have memory issues on smaller machines.

I'll look into it, but in the meantime if you move some of the OS zip files called e.g. "hx62_OST50GRID_20170713.zip" into a new directory, you could build a smaller raster to work from. You want the GRID files not the CONT (contour) ones.

You can look up which files you want to draw different parts of the UK here https://www.ordnancesurvey.co.uk/business-and-government/help-and-support/products/tile-locator-maps.html

E.g. you'd pick a combination of SD and NY to cover the Lake District.

It will all work exactly the same way after that but you'll only be able to draw locations in your data subset, not of the whole UK.

chris-billingham commented 5 years ago

Ah yes that may be it, running on a Mac with 8GB.

That sounds a good interim solution as I'm only really looking for Peak District and surrounds. I'll do that.

Thanks for the help!

neilcharles commented 5 years ago

I've changed the way that the mosaic function works so that it loops and only loads one raster at a time (boooo, it loops now instead of purrr:map). Run these two lines first and combined with the new code it should work better.

library(raster) rasterOptions(todisk=TRUE)