The Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Google API
Replies: 3   Last Post: Apr 21, 2014 10:11 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Clemens

Posts: 6
Registered: 12/23/13
Re: Google API
Posted: Apr 14, 2014 8:04 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Mazin" wrote in message <life7r$mk0$1@newscl01ah.mathworks.com>...
> I need to setup matlab to use some Google API features.
> I need to give matlab a physical address "street address' and then matlab passes that to Google to get the longitude and latitude of that address , then I can do my own calculation with the longitude and latitude I receive.
>
> In the file exchange section I found some ready made functions but I couldn't follow them entirely. I'm asking first do I need to do any special setup to link matlab to Google before running a code ?



Here some code, where adresse is your address as a string.

% Parent URL
url = 'http://nominatim.openstreetmap.org/search?format=xml&q=';

% Read from google:
xDoc = xmlread(strcat(url,adresse));

allPlaces = xDoc.getElementsByTagName('place');
firstPlace = allPlaces.item(0);

if ~isempty(firstPlace)
lat = str2double(firstPlace.getAttribute('lat'));
lon = str2double(firstPlace.getAttribute('lon'));

else % Location in South Atlantic Ocean
lat = -1;
lon = -1;
end


Date Subject Author
4/13/14
Read Google API
Mazin
4/13/14
Read Re: Google API
matt dash
4/14/14
Read Re: Google API
Clemens
4/21/14
Read Re: Google API
Mazin

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.