Hello I have a location button to find me, but then i want to take that return value and insert it into my textbox so i can create directions??
Hello I have a location button to find me, but then i want to take that return value and insert it into my textbox so i can create directions??
Hi Jimmy,
You can create a local storage variable, save there your location and then use it for your textbox.
This post may be helpful:
http://blog.tiggzi.com/tag/geolocation/
Katya thank you for your reply. I did follow this code in your link but I want do the reverse. I want to click my "map me" button that finds my current location, then positions me on the map, then populates the address values in my "from" textbox.
Then the user would click on get directions button to map their way to our restaurant.
So the javascript would look something like this (in plain english):
local.variable = "geolocation.address";
fromSource.Textbox.text = "local.variable";
I tried to use the IDE to assign a local varialble, then assing the value to the textbox but it didn't seem to work. Here's what I have visually:
I am using all the code provided in the tutorials for the whole page. (great work by the way). Anyway, how can i get the "map me" values to populate the From textbox?
Can you show me the code? again I am using all the code from your tutorials.
Hi, could you clarify please are you going to put address to the text field according to received coordinates? Or it should be just coordinates (lat and long)?
yes I would like the address to be populated as thr customer will not understand longitude and latitude. hopefully this is clear.
To get address you have to use additional REST request to http://maps.googleapis.com. Here is more information https://developers.google.com/maps/do...
1) Create REST service with the parameters described here https://developers.google.com/maps/do...
In Request mapping to latlng add JS to get coordinates from localStorage.
Map Response formatted_address to textbox.
2) In Geolocation service map latitude and longitude to localStorage variables.
3) On success Geolocation service call created service (see item 1)
So on click you invoke the service to get coordinates, the automatically (see item 3) will be called service to show coordinates in human-readable address and address will be shown in textbox.
Marina, the http://maps.googleapis.com goes to a dead page. Just curious bc i am new to all of this, if you can create a step by step tutorial showing all the parts. That would be a great help and make a new customer super happy ...
Test failed! Please check service properties and the error details in "Response" area.
Sorry, unfortunately we can't create tutorial for each case:)
1) For URL use http://maps.googleapis.com/maps/api/g...
- Method: GET
- Data Type: json
Request parameters:
latlng: - 40.714224,-73.961452
sensor: true
2) Click Test, Automatically Create Service Response - you'll get response structure which you can use in mapping
3) In Geolocation service map latitude and longitude to localStorage variables
4) In Request mapping to latlng add JS to get coordinates from localStorage.
codereturn localStorage.getItem("latitudeSaved") + ',' + localStorage.getItem("longitudeSaved");/code
where latitudeSaved and longitudeSaved - localStorage names (see item 3)
5) Map Response formatted_address to textbox.
6) On success Geolocation service call created service (in item 1)
Hope this helps
Hello, 3/4/5/6 are still not clear. I am still a novice to Request mapping latlng add JS is not clear?
Geez we could have been done hours ago if you were more specific as i requested, I do appreciate the help, but this whole thing could have been done 3 posts ago?
If you could kindly just explain it better; that would be very much appreciated. I didn't think this would take all day.