12-20-2016 07:22 AM
Hey guys,
I am currently using this template LabVIEW GoogleMpas API to insert a place or coordinates into google maps and receive the result inside LabVIEW.
Since the API has changed I had to make a few adaptions but it works.
Now I want to do the following: I want to enter the name of a place and the API shall give me the coordinates --> Geocoding. The procedure is shown here:https://developers.google.com/maps/documentation/geocoding/intro?hl=de
Writing into the URL should lead to an result in "JSON":
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key="MyKEY"
But I dont have a clue how to receive the result of my request?!
I have added a snapshot of my attempt, but the used method is either wrong or I am not using it correctly...
(I have LabVIEW 2015 SP1 (32bit) + Windows 10 Education (64bit))
kind regards
Slev1in
Solved! Go to Solution.
12-20-2016 07:39 AM - edited 12-20-2016 07:40 AM
Hi Slevin,
using a browser with your URL
https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+... (I removed this silly MYKEY at the end!)
I get the following result:
{ "results" : [ { "address_components" : [ { "long_name" : "1600", "short_name" : "1600", "types" : [ "street_number" ] }, { "long_name" : "Amphitheatre Parkway", "short_name" : "Amphitheatre Pkwy", "types" : [ "route" ] }, { "long_name" : "Mountain View", "short_name" : "Mountain View", "types" : [ "locality", "political" ] }, { "long_name" : "Santa Clara County", "short_name" : "Santa Clara County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "California", "short_name" : "CA", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "USA", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "94043", "short_name" : "94043", "types" : [ "postal_code" ] } ], "formatted_address" : "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA", "geometry" : { "location" : { "lat" : 37.4223664, "lng" : -122.084406 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 37.4237153802915, "lng" : -122.0830570197085 }, "southwest" : { "lat" : 37.42101741970851, "lng" : -122.0857549802915 } } }, "place_id" : "ChIJ2eUgeAK6j4ARbn5u_wAGqWA", "types" : [ "street_address" ] } ], "status" : "OK" }
Then all you need to do is some easy string parsing to get the values after "lat"/"lng"…
12-23-2016 05:33 AM - edited 12-23-2016 05:43 AM
Hey Gerd,
thank you for your quick answer.
Well, I should have tried out entering that URL on my own...but thanks.
I noticed, that I always "receive" a "json" file when I execute the "Webbrowser" invoke-node. But a Windows window prompts and asks me to save the file (like every download file). Inside that file is the JSON code.
EDIT: I FOUND A WAY...using the following VIs (see appendix). I now just have to further process it.
Thanks for your help guys and merry christmas