File Exchange

image thumbnail

getElevations(latit​ude, longitude, varargin)

version 1.1.0.0 (3.12 KB) by Jaroslaw Tuszynski
getElevations function queries Google Maps API webservice for ground elevations

16 Downloads

Updated 14 Dec 2017

View Version History

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

getElevations function queries Google Maps API webservice for ground elevations. See https://developers.google.com/maps/documentation/elevation/ for details.

Cite As

Jaroslaw Tuszynski (2021). getElevations(latitude, longitude, varargin) (https://www.mathworks.com/matlabcentral/fileexchange/50704-getelevations-latitude-longitude-varargin), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (12)

Evan Bates

Update to my comment: You know have to activate billing on Google API

Evan Bates

Worked great, however, now it is throwing an error. I believe google API updated and now this function no longer works.

Jim Goodall

Easy, exactly what I was looking for.

Juliana

Samuele Moscatelli

Thomas Moser

Some times i have the message "Google Maps API requestor has exceeded quota" & sometimes i haven't ... Someon can help me ? I read the quotas of free account Google API but i think i respect this.

Thomas Schilling

OK, the error is just a matter of the API response. Simple fix (AA is lat and lon):

e = nan(size(AA,1),1);
while(sum(isnan(e))>0)
disp(num2str(sum(isnan(e))))
for i = 1:size(AA,1)
if isnan(e(i,:))==0
continue
end
try
e(i,:) = get_Elevations(AA(i,1),AA(i,2));
catch
e(i,:) = nan;
end
end
end

Thomas Schilling

Using the example I get:

Error using getElevations (line 79)
Google Maps API requestor has exceeded quota

Ingvild Forseth

Will Campbell

Jonas Hahlbohm

Chad Greene

This is fantastic. Easy to use, good error checking, and worked right out of the box. I ran into a query limit when I tried an array of 4800 points, but 480 points retrieved results in under a second. Grids work too. NaNs throw a urlread error, which is not intuitive to debug--perhaps a NaN check would help.

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: pinxau1000/Matlab-Google-Elevation-API

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!