Created
June 18, 2019 00:49
-
-
Save SimonCoulombe/b1b6394c623eeb4c92520392dc4f5b2d to your computer and use it in GitHub Desktop.
cant detect water
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(tidyverse) | |
ex.df <- data.frame(x=seq(from= -70.5813 , to= -70.36120, length.out=100), | |
y=seq(from= 47.80355 , to= 47.96210, length.out=100)) | |
elev_raster <- elevatr::get_elev_raster( | |
ex.df, | |
prj = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", | |
z = 10, | |
clip = "bbox") | |
rayshader::detect_water(raster::as.matrix(elev_raster) ) %>% | |
raster::raster() %>% | |
raster::plot() | |
#no water except on the edge according to the plot | |
# satellite images show a rive going through the box | |
# 47.884566, -70.479631 | |
https://www.google.com/maps/place/47%C2%B053'04.4%22N+70%C2%B028'46.7%22W/@47.8886556,-70.4874518,14z/data=!4m5!3m4!1s0x0:0x0!8m2!3d47.884566!4d-70.479631 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The resolution of your map is too low.
detect_water()
looks for continuously flat areas of minimum size, but if the map is too low resolution and the bodies of water are small (e.g. rivers and streams) it can't detect them. Here, I upped the resolution of the map and ran detect_water with some slightly different arguments and successfully detected some of the water. Try adjusting min_area and cutoff around until you get a reasonable performance.