Making elevatr more user-friendly outside the US?
Opened this issue · 1 comments
Just a suggestion/feature request for others.
For now, when using the function retrieving elevations outside the US, the function will attempt to do the work (which takes a lot of time on large dataset) and returns a series of rather uninformative error messages which do not hint towards using src = "aws"
.
I wonder if it would not be more user-friendly and relatively straightforward to implement a short test on the locations beforehand to check whether the locations are covered or not by the selected source and either err at that point or automatically shift the src.
Example:
test <- structure(list(
y = c(
36.521581,
36.521581,
37.518606,
37.518606,
37.518606,
37.518606,
37.518606,
37.518606,
37.518606,
37.518606
),
x = c(
-5.590503,
-5.590503,
-5.977033,
-5.977033,
-5.977033,
-5.977033,
-5.977033,
-5.977033,
-5.977033,
-5.977033
)),
row.names = c(NA, 10L), class = "data.frame")
elevatr::get_elev_point(test, prj = 4326)
#> Downloading point elevations:
#> API error, NA returned for elevation
#> API error, NA returned for elevation
#> API error, NA returned for elevation
#> API error, NA returned for elevation
#> API returned an empty repsonse (e.g. location in ocean or not in U.S.). NA returned for elevation
#> API returned an empty repsonse (e.g. location in ocean or not in U.S.). NA returned for elevation
#> API returned an empty repsonse (e.g. location in ocean or not in U.S.). NA returned for elevation
#> API error, NA returned for elevation
#> API returned an empty repsonse (e.g. location in ocean or not in U.S.). NA returned for elevation
#> API error, NA returned for elevation
#> Note: Elevation units are in meters
#> Simple feature collection with 10 features and 2 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: -5.977033 ymin: 36.52158 xmax: -5.590503 ymax: 37.51861
#> Geodetic CRS: WGS 84
#> geometry elevation elev_units
#> 1 POINT (-5.590503 36.52158) NA meters
#> 2 POINT (-5.590503 36.52158) NA meters
#> 3 POINT (-5.977033 37.51861) NA meters
#> 4 POINT (-5.977033 37.51861) NA meters
#> 5 POINT (-5.977033 37.51861) NA meters
#> 6 POINT (-5.977033 37.51861) NA meters
#> 7 POINT (-5.977033 37.51861) NA meters
#> 8 POINT (-5.977033 37.51861) NA meters
#> 9 POINT (-5.977033 37.51861) NA meters
#> 10 POINT (-5.977033 37.51861) NA meters
Best,
Alex
This is a great idea for get_elev_point. It defaults to epqs which is the US Geologic Surveys point query service so by definition is US only. The easiest change would be to use aws as the default source, but that is a pretty big API change and could cause problems for people.
I think implementing a check on the data to make sure it is in the US is a good option. I'll add that to my list!
And thank you for all the suggestions and testing. Been really helpful.