Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
LOCAL lcSt, lcMethod, lcLong, lcLat, lcLong1, lcLat1
ON KEY LABEL ESC SUSPEND
SET DECIMALS TO 8
USE Addresses
lcMethod = 'TERRASERVER'
*lcMethod = 'CDYNE'
SCAN
lcSt = UPPER( ALLTRIM(Address.hse_num)+'+'+STRTRAN(ALLTRIM(Address.Street),' ','+') )
? "Processing Record ",RECNO(),"of",RECCOUNT(), lcSt, Address.zipcode, address.State
DO CASE
CASE lcMethod='TERRASERVER'
* You may have to log in to terraserver.microsoft.com and get a VIEWSTATE value for yourself:
lcGetUrl = 'http://www.terraserver.microsoft.com/address.aspx?__VIEWSTATE=dDwxNzM4NTI3NTc7O2w8U2VhcmNoOz4%2B';
+'&Street='+lcSt;
+'&City=';
+'&State='+ALLTRIM(address.State);
+'&ZipCode='+ALLTRIM(address.zipcode);
+'&Search.x=0&Search.y=0'
ReadUrl( lcGETURL )
lcLong = SUBSTR(pineview.Resp, ATC('&lon=',pineview.Resp)+5)
lcLong1 = LEFT( lcLong, ATC('&',lcLong)-1 )
lcLat = SUBSTR(pineview.Resp, ATC('&lat=',pineview.Resp)+5)
lcLat1 = LEFT( lcLat, ATC('&',lcLat)-1 )
REPLACE address.Longitude WITH VAL(lcLong1), ;
address.Latitude WITH VAL(lcLat1)
CASE lcMethod='CDYNE'
* This is a webservice that can do the same thing, only with much simpler code,
* and it offers about 5 minutes of free trial on license key "0" before locking you out:
* See http://ws.cdyne.com
lcGetUrl = "http://ws.cdyne.com/psaddress/addresslookup.asmx/AdvancedCheckAddress" ;
+'&AddressLine='+lcSt;
+'&AddressLine2=';
+'&ZipCode='+ALLTRIM(address.zipcode);
+'&City=';
+'&StateAbbrev='+ALLTRIM(address.state);
+'&LicenseKey=0';
+'&Invoke=submit'
ReadUrl( lcGETURL )
lcXML = SUBSTR( bayview.resp, AT(CHR(13)+CHR(10)+CHR(13),bayview.resp)+4 )
XMLTOCURSOR(lcXML,'Response')
REPLACE Addresses.Longitude WITH response.AvgLongitude, ;
Addresses.Latitude WITH response.AvgLatitude
lcLong1 = response.AvgLongitude
lcLat1 = response.AvgLatitude
ENDCASE
??" Long=",lcLong1," Lat=",lcLat1
FLUSH
ENDSCAN