Create a google key for your application
You need to go to the google developer console and create your application, create a key, don’t forget configure callbacks urls for your site and ative “Google Maps Embed API”.
https://console.developers.google.com/
Example of implemantation :
Html file
http://pathGoogleMaps
JS file
Template.myTemplate.helpers({ pathGoogleMaps: function(){ // I put the latitude and longitude in the session of the page var origin ; if (Session.get('lat') != null && Session.get('lon') != null) { origin= Session.get('lat') + "," +Session.get('lon'); } var path = ""; if ( origin != undefined && origin != null ) { // When have the origen defined var destination = this.location.latitude + "," + this.location.longitude; path = "https://www.google.com/maps/embed/v1/directions" + "?key=myGoogleKey"; path+= "&origin=" + origin; path+= "&destination="+ destination; path+= "&avoid=tolls|highways"; } else { // When I don't have the origen and destination path = "https://www.google.com/maps/embed/v1/place" + "?key=myGoogleKey"; path+= "&q=" + this.street + "," + this.addressNumber + "," + this.neighborhood + "," + this.city ; path+= "&zoom=14&maptype=roadmap"; } return path; } });
Result :
Google Directions API :
https://developers.google.com/maps/documentation/directions/
I love your blog.. very nice colors & theme. Did you make
this website yourself or did you hire someone
to do it for you? Plz respond as I’m looking to create my own blog and would like
to know where u got this from. thanks
LikeLike
Great website. Lots of helpful information here.
I’m sending it to a few pals ans also sharing in delicious.
And certainly, thanks in your effort!
LikeLike
I every time used to study paragraph in news papers but
now as I am a user of internet therefore from now
I am using net for posts, thanks to web.
LikeLike
I every time spent my half an hour to read this weblog’s articles everyday along with a mug of coffee.
LikeLike
Wow that was odd. I just wrote an incredibly long comment
but after I clicked submit my comment didn’t show up. Grrrr…
well I’m not writing all that over again. Anyhow, just wanted to say wonderful blog!
LikeLike
Good day! I could have sworn I’ve been to this site before but after browsing through some of the
post I realized it’s new to me. Nonetheless, I’m definitely happy
I found it and I’ll be bookmarking and checking back frequently!
LikeLike
I always spent my half an hour to read this weblog’s content
all the time along with a cup of coffee.
LikeLike
Hey dude, the link for the html file above isn’t working. Can you update that so we can actually see the html?
Thanks!
LikeLike
Send your problem for us. We can try help you.
LikeLiked by 1 person