Dan, could you provide some more specifics here? Altitude in meters, feet, or furlongs? Against what reference? Number of significant digits you expect? Latitude and longitude are in decimal degrees? An example would also help.
Thank you for suggestions
I like test #7. Although doing it the "right" way, I seem to get decimal precision on the negative values which caused it to fail the test suite.
Fixed tests with negative values and rescored solutions!
This problem should probably be removed from Cody. The only way to find the required number is by registering at Google's platform with a credit card for a free trial (It has become like so since 2018). https://developers.google.com/maps/documentation/elevation/start
Other sites find the elevation given the same problem coordinates, but not with the same precision (1e0). The author should make the accuracy way more error-tolerant, 1e2, or delete the problem.
PS: For instance, Everest (27.988056°N 86.925278°E) 8840.0 m according to https://www.freemaptools.com/elevation-finder.htm, 8806.0 m according to https://www.maps.ie/coordinates.html, and 8518.0 m according to https://www.daftlogic.com/sandbox-google-maps-find-altitude.htm (which would require accepting precision of 5e2)
FYI: The mount Everest is 8,848 m height. https://www.britannica.com/place/Mount-Everest/The-height-of-Everest
Rafael S.T. Vieira brings up some good points. The tolerance has been updated to +/– 250 (500 total) so that the problem can be solved. Making the error window larger than that may be too generous, though.
Thanks, goc3, that made me hopeful, but there is still one problem. Cases #4 and #5 have depth data instead of elevation. And depth data is not available from any of the previously mentioned sites, and more: https://nationalmap.gov/epqs/, https://api.opentopodata.org/v1/eudem25m?locations=11,142, https://api.open-elevation.com/api/v1/lookup?locations=25,-90, https://developers.airmap.com/docs/elevation-api. I guess no one would imagine someone would be interested to know ocean depth. So to make this problem feasible without Google maps, it would still be necessary to remove cases #4 and #5, or to allow the use of the command if (to people that will use a site without depth data). Some people solved this problem using a creative form of lookup table without an if (cheaters). Therefore, this problem still needs some fixing...or to be deleted.
PS: I solved the problem using Google's API, and deleting my private-key afterward. If the test suite is changed, it won't work again (and all solutions really because they don't have keys or use lookup tables). Even if I didn't delete my private-key, it will only work for three months unless I pay a fee.
I've tried several available satellites on the internet, and none of them show depth. And, in general, we probably can say that sites with GPS only care about places where land vehicles can cross. Requesting depth makes it a problem that is solvable only with google or some other paid service (probably).
PS: Even NASA's database don't give access to such information according to https://www.gpsvisualizer.com/elevation
Those are more good points, Rafael. I commented out the test cases with negative results (#4, 5).
Thanks again, goc3. Now it's working without requiring Google maps or a paid service. :)
the expected level of precision of the responses seems a bit unreasonable (<1 nanometer?), perhaps you could allow +-1% error in the returned altitude responses?
Modified tolerance of the answers.
Back to basics 6 - Column Vector
Back to basics 20 - singleton dimensions
Generate a NaN...on purpose
Derivative of polynomial
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office