Loading Directions with Google Maps API v3 - google-maps-api-3

I've just gotten started with the Google Maps API and I've been following all the documentation. Currently I'm trying to use the Directions Service of the API, but nothing seems to render. Help?
Here is a directory with all of the files.
http://kkohlmorgen.com/googleAPI/

There may be other issues, but the first thing I notice is that you are trying to declare the directionsService when the page loads, but you don't load the Google Maps API until you click the Load Map button. So it throws a "google is not defined" error when you declare directionsService. Thus, when you call directionsService later, it is undefined. You should load the Google Maps API before running any other map related javascript.

Related

Google maps API directions service redirects to JSON info, but how do I get it to open map app in phone?

I'm new to Google Map API. The following javascript opens a new page with the JSON data. The google documentation gives the following URL example, (I added the window.open javascript part). But there isn't a complete example anywhere that I found.
I'm trying to open this from my asp.net website, into open the google maps app on a phone to the places indicated. Of course, the places will be put in programmically.
function myNavFunc4(){
window.open("https://maps.googleapis.com/maps/api/directions/json?origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK&key=My_KEY");
}
In order to launch Google Maps app from your website you can use the Google Maps URLs. This API was designed for this purpose.
Instead of using Directions API web service endpoint in your script you should create a Google Maps URL for directions.
E.g.
function myNavFunc4(){
window.open("https://www.google.com/maps/dir/?api=1&origin=Chicago,IL&destination=Los+Angeles,CA&waypoints=Joplin,MO|Oklahoma+City,OK");
}
For further details please have a look at Google Maps URLs documentation.
Enjoy.

Debugging FullCalendar to Google Calendar integration

I was asked to implement FullCalendar for our company's web application to pull in a calendar from Google Calendar. I have imported and referenced the JS and CSS files to where I am getting the calendar to appear to appear on the page configured the way that we want, however, there no events showing up.
I saw on the FullCalendar site a note, "If you need to detect errors with the Google API ... You'll need to use the FullCalendar's googleCalendarError callback ..." But there was no examples and no documentation on how to perform this. I Googled for examples and found no code examples of how to do this so that I could debug what was happening and why the calendar appears structurally, but with no calendar data. Any help would be appreciated. Thanks.
Update: After playing with the gcal.html demo example that comes with FullCalendar, I was able to get my calendar to work and show event information in gcal.html. However, in my MVC .net application there is a JS error stating "Failed to load resource: the server responded with a status of 404 ()" and it shows my MVC view page address on my local machine appended with the google calendar id, along with start and end dates. I am wondering where I go from here to get my calendar to appear in my MVC .net web application view page and pull event information from Google.

Confused by RefererDeniedMapError

I'm trying to use the Google Maps Javascript Geocoder code. I figured I'd start with their example at https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple
I copied their code exactly, putting in my Browser Key where it said YOUR_API_KEY,
and the page seems to load for a moment, and then I get this error in my console:
Google Maps API error: RefererDeniedMapError
And a Javascript alert telling me that it was unable to load.
I have checked my developer console and I have enabled the Google Maps JavaScript API, and I don't have any referrers set up for that key (which is supposed to let all requests through), and yet I still get this error.
I have to believe I still have a setting wrong somewhere, but the console is so simple to use I can't identify where. Can anyone give me the benefits of their experiences on setting up the Browser key to work properly?
Thanks in advance,
DW

How would you go about writing a custom script that grabs the Adobe or Google Analytics image request?

If I wanted to build a scraper that pings each URL on a site and stores the adobe (or Google) image request, how would I go about this? I.e. I just want something that grabs all the parameters in the URL posted to Adobe in a csv or something similar. I'm familiar with how to build simple web scrapers, but how do I grab the URL I see in for example Fiddler that contains all the variables being sent to the Analytics solution?
If I could do this I could run a script that lists all URLs with the corresponding tracking events that are being fired and it would make QAing much more manageable.
You should be able to query the DOM for the image object created by the tag request. I am more familiar with the IBM Digital Analytics (Coremetrics) platform and you can find the tag requests using accessing the following array document.cmTagCtl.cTI in the Web Console on a Coremetrics tagged page. I used this method when building a Selenium WebDriver test case and wanted to test for the analytics tags.
I don't have the equivalent for Adobe or GA at the moment since it depends in the library implementation am trying the do the same as you for GA.
Cheers,
Jamie

How do you activate Google Maps JavaScript API v3 service?

The tutorial doesn't say how to activate the Javascript API v3 service. It just says do it. My Google Developers Console screen doesn't match the screen they show in the written (probably out of date) tutorial.
There is no "Service" category for me to choose. I have a "Terms of service" category which, when chosen, allows me to read the terms for this particular API but there is no action to be taken in that window. I have an API key and I have entered the code in my web page and placed my API key in it.
I get the following error message when loading the web page: "This page was unable to display a Google Maps element. The provided Google API key is invalid or this site is not authorized to use it. Error Code: InvalidKeyOrUnauthorizedURLMapError" and I think it may be because I have not been able to "activate" API v3 for this project.
I have tried the following:
Regenerating a key and using it immediately so I know it isn't that the key is over 24 hours old
Double checked my referrals
Accurately entered the name of the site where I am trying to make this work.
You need to activate API from the Developer Console
click the 4^ and then click the "Enable API" blue button
I wasted my time just because of confusion so i am answering here with updated screenshots to help in a better way.

Resources