How to get json file from Google Maps APIs

Offers and request for collaboration between partners, developers and users worldwide. Full-time and freelance jobs, employee recruitment.

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jul 3, 2013
Company: TRIAX

Hi all!
I use Google Maps API with web browser to get distance from 2 positions,  
URL:"https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=Gia%20B%C3%ACnh,%20B%E1%BA%AFc%20Ninh,%20Vi%E1%BB%87t%20Nam&destinations=C%E1%BA%A7u%20Gi%E1%BA%A5­y,%20H%C3%A0%20N%E1%BB%99i,%20Vi%E1%BB%87t%20Nam&key=AIzaSyA8u0Rb8vCXPrPkfVCVkhu763ms-Ne2wa8";

How to use 1C to get data json file

Im trying to code by HTTP Service with JSON POST:

HTTP = New HTTPConnection("maps.googleapis.com",,,,,True);
RequestBodyFile = GetTempFileName();
ResourceLink = "maps/api/distancematrix/json?units=metric&origins=Cầu Giấy, Hà Nội, Việt Nam&destinations=Từ Sơn, Bắc Ninh, Việt Nam&key=AIzaSyA8u0Rb8vCXPrPkfVCVkhu763ms-Ne2wa8"
FileResult = GetTempFileName();
RequestHeaderHTTP = New Map();
HTTP.Post(RequestBodyFile,ResourceLink,FileResult,RequestHeaderHTTP);
AnswerFile = New TextDocument;
AnswerFile.Read(FileResult, TextEncoding.UTF8);
ServerResponseLine = AnswerFile.GetText();
ReaderJSON = New JSONReader;
ReaderJSON.OpenFile(FileResult);
StructureArray = ReadJSON(ReaderJSON);
If StructureArray.status = "OK" AND StructureArray.rows[0].elements[0].status = "OK" Then
 distance = StructureArray.rows[0].elements[0].distance.value/1000;
EndIf;

Please give me an example

 
#2
People who like this:0Yes/0No
Interested
Rating: 16
Joined: Dec 4, 2017
Company:

Dear Hoang Minh Tri,

Am I right that according to How to use json to get distance 2 positon from Google Maps APIs, you have already found a working example?

Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.