Created
July 26, 2013 02:07
-
-
Save dbuscombe-usgs/6085499 to your computer and use it in GitHub Desktop.
Geocoder wrapper for matlab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [lat,lon] = geocode(address) | |
fid=fopen('test.py','wt'); | |
fprintf(fid,'%s\n','from pygeocoder import Geocoder'); | |
fprintf(fid,'%s\n',['results = Geocoder.geocode(''',deblank(address),''')']); | |
fprintf(fid,'%s\n','print results[0].coordinates'); | |
fclose(fid); | |
[stat1,stat2]=system('python test.py'); | |
stat2=deblank(stat2); | |
stat2=stat2(2:end-1); | |
lon=str2num(deblank(stat2(regexp(stat2,',')+1:end))); | |
lat=str2num(deblank(stat2(1:regexp(stat2,',')-1))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment