Buy Now
Sign in

widget google address

webcrea , May 09 2019, 11:56
webcrea 584
May 09 2019, 11:56 #386673
Hi,
Could you add latitude and longitude in the google address widget ?
Thanks
Christophe
http://www.webcrea.fr
healyhatman 8
May 09 2019, 12:08 #386676
While you're waiting, you can add a little javascript to get it yourself
https://stackoverflow.com/questions/13478646/google-map-api-get-latitude-and-longitude-from-autocomplete-without-map
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
webcrea 584
May 09 2019, 12:13 #386678
Thanks Healy
We don't need an API key with this?
Christophe
http://www.webcrea.fr
healyhatman 8
May 09 2019, 12:18 #386680
You sure do. This JS would be AFTER you've used the address widget to get the place ID
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
webcrea 584
May 09 2019, 12:22 #386681
There are several code..?
Christophe
http://www.webcrea.fr
healyhatman 8
May 09 2019, 12:23 #386682
There sure are, do you know a little JS? Pick the one that seems best. Too tired to do it for you at the moment sorry, but it gives you a place to start.
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
webcrea 584
May 09 2019, 12:39 #386685
ok thanks
Christophe
http://www.webcrea.fr
webcrea 584
May 09 2019, 13:45 #386688
something I don't understand
I load the api
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyArIMfFJkRRrUBQh1wfcUjYx8dYPfBt5mI&callback=initMap" type="text/javascript"></script>
the script js
prospect_town = jQuery("#prospect_town");
prospect_country = jQuery("#prospect_country");
prospect_state = jQuery("#prospect_state");
jQuery(countries).on("change", function(){
prospect_country.val(countries.val());
});

jQuery(countries).on("change", function(){
prospect_state.val(states.val());
prospect_country.val(countries.val());
getLatLngFromAddress( prospect_town.val(), prospect_country.val() )
});

function getLatLngFromAddress(town, country){

var address = town +", "+ country;
var geocoder = new google.maps.Geocoder();

geocoder.geocode( { 'address': address}, function(results, status) {

if (status == google.maps.GeocoderStatus.OK) {
jQuery('#latitude').val(results[0].geometry.location.Pa);
jQuery('#longitude').val(results[0].geometry.location.Qa);

} else {
console.log("Geocode was not successful for the following reason: " + status);
}
});
}
After select a town the console indicate the key is not good!!!
Geocoding Service: This API project is not authorized to use this API. For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key js:55:110
Geocode was not successful for the following reason: REQUEST_DENIED
The key is valid with the google address widget, it works...
Christophe
http://www.webcrea.fr
healyhatman 8
May 09 2019, 14:15 #386692
Places API and the Maps API might be different, follow the link and have a look
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
webcrea 584
May 09 2019, 14:24 #386693
Twice are activate
Christophe
http://www.webcrea.fr