USEPA / elevatr

An R package for accessing elevation data
Other
203 stars 26 forks source link

get_elev_point() not working in NZ #61

Closed TomC-93 closed 2 years ago

TomC-93 commented 3 years ago

Hi - thanks for developing such a useful package. I've been recently trying to use it to get elevation data for different countries across the globe and I noticed that I occasionally receive the following error: This url: https://s3.amazonaws.com/elevation-tiles-prod/geotiff/5/32/21.tif did not return a tif But for some reason this predominantly happens for points selected in NZ. Not all points in NZ, but from a random selection of coordinates throughout the country only around 25% seemed to work.

After some googling I came across this question on Stack Overflow: https://stackoverflow.com/questions/65863300/how-to-access-multiple-elevation-points-at-the-same-time-with-get-elev-point Which seemed to have a similar problem, although they don't state how it was solved.

I can confirm that the points I selected were definitely on land, not in the sea, so I suspect it may have something to do with accessing NZs elevation data correctly? I'm not sure, but wanted to make you aware. Cheers, Tom

jhollist commented 3 years ago

@TomC-93 I think I have this figured out. Just need to work out a solution.

Problem stemmed from my North American bias! My code to convert lat long to xyz for the tiles, didn't account for things with coordinates near -180/180. So, I am telling it to ask for tiles that that don't exist. Stay tuned!

jhollist commented 2 years ago

@TomC-93 I have a solution for this in the development version now on GitHub. Working on a CRAN release around the new year. Should grab the correct tiles. One word of caution, if you have points with longitude on either side of 180 (e.g. 179 and -179), you are probably better off running those through elevatr separately. Otherwise elevar will grab tiles from 179 to -179!