-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spatial analysis issues #20
Comments
note to self: spatial random sample workaround fails occasionaly, - change to sp version? |
I think we should have two options:
|
so in the current template there is the option to download in advance and save/send as a .rda, from hq to field for example. |
Ok nice. Yeah whatever is more common. Maybe it is just my bubble where nobody uses shapefiles ;) |
Possible work around https://cran.r-project.org/web/packages/ggspatial/vignettes/ggspatial.html |
chris - see zhian's point about rjava and dependencies - we definitely need a better solution for basemaps. |
The |
Just realized that ggspatial imports functions from rosm. I think it may be possible to pre-download tiles for a given region with their API, and store it in a folder, then use |
yep, rosm only available for baseplot though. ggspatial same functionality but makes available for ggplot. |
After I polish the template a bit, I'll work on trying to get a reasonable workflow for getting the tiles. |
pretty sure chris is on it |
Then I will hold off |
Have been looking at this today. As far as I can tell ggspatial only downloads the tiles when you add a spatial geom after annotation_map_tile, it doesn't appear to allow you to just specify that you want to download the tiles. If you add a cache directory then it will create the folder and store the tiles there. These tiles can be used offline. It's works but the tiles don't look great with the ggplot maps. I'll see if can improve them but speaking to Alex perhaps we can look at the internals of annotation_map_tile and change it so we can just download the tiles we want without having to create a map each time. |
There might be an easier work around in here than in our current setup.... Will look in to eventually |
I associate tiles with raster files -- will downloading tiles allow for admin-2 or admin-3 level divisions? or is this just to provide a base map? Ceramic uses NE to define the tile extent, but then we'd also need to load NE. Also, a word of caution that health districts in many countries are different from admin levels...in both Chad and DRC, this was the case. |
Tiles is just basemaps. I.e. a picture.
You don't want to switch to ceramics. It's not on cran yet and switching
tile provider is still complicated.
Gadm is the package for getting admin level packages. All the spatial stuff
has been relatively sorted the old generic outbreak template. Zhian can dig
it out but focus on the other stuff before getting to this.
…On Tue, 6 Aug 2019, 20:19 Kate Doyle, ***@***.***> wrote:
I associate tiles with raster files -- will downloading tiles allow for
admin-2 or admin-3 level divisions? or is this just to provide a base map?
Ceramic uses NE to define the tile extent, but then we'd also need to load
NE.
Also, a word of caution that health districts in many countries are
different from admin levels...in both Chad and DRC, this was the case.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#20?email_source=notifications&email_token=AEL7IJYFQ5AS436AK2FVTH3QDG6EZA5CNFSM4GPFKLYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3WAVOI#issuecomment-518785721>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEL7IJ5PTB7DIYTKXRGO423QDG6EZANCNFSM4GPFKLYA>
.
|
I believe the last commit where the outbreak report existed was here: |
Note to self: see latest carto release and slippymap package to improve image res https://t.co/6OvNpqLoSC?amp=1 alternatively use {maptiles} (which uses {terra}) and then plot with tidyterra::geom_spatraster_rgb - or potentially with terrainr::geom_spatial_rgb |
I have added a basic section to spatial analysis using the "tmap" package (with "tmaptools" too).
I chose this because it allows both sf and sp files and has similar syntax to ggplot2 but simpler for manipulating spatial data.
The reason I decided against ggmap - is that it really didnt work well in the field on poor internet connection (would often just get kicked out and it wouldnt download at all) - and the style options arent great either.
In general tmap is quite a nice package, allowing for static and interactive maps.
That comes with issues though as it has a lot of dependencies!
The biggest issue is that to get static tiles it uses the "openstreetmap" package which is rjava dependent and produces quite poor resolution rasters.
For interactive maps it uses leaflet package. Which has great tile backgrounds but only interactive ones. Leaflet also has more server options, and particularly important is that it supports openstreetmap black&white as well as humanitarian openstreetmap (no other packages seem to provide these and they are the most important ones!!).
It would be really awesome if we could somehow manage to pull leaflet backgrounds in to static tiles. Alternatively "openstreetmap" package allows to specify server destinations to pull tiles from - so maybe theres a possible work around in there?? (just need to find a stable server with an api?)
The second thing I couldnt seem to get to work is creating kernel density (or heatmaps) - using the smooth_map function from the "tmaptools" package - based on points data.
If we manage a work around for getting tiles in (and dont want all the dependencies of tmap) then using the sf package with ggplot2 is equally simple and functional!
The text was updated successfully, but these errors were encountered: