we have a problem with our fusion table implementation when using google maps versin 3.23 (exp) or 3.22 (stable). With these versions, when we are trying to create a layer, we get Uncaught TypeError: Cannot read property 'stack' of undefined. The following lines in our code is not working with 3.23 or 3.22:
layer = new google.maps.FusionTablesLayer({
query: {
select: 'Full address',
from: selectedFusionTableId,
where: sql
},
options: { suppressInfoWindows: true },
styleId: 1,
templateId: selectedFusionTableInfoWindowTemplateId
});
The implementation has been working with google maps version 3.21 (current frozen version) for a year, so I wonder if there are something we can do on our side or if there is something broken in the google maps versions 3.22 and 3.23?
Since google maps is using version rollover, our implementation will stop working next time google updates googlemaps versions.
Application can be found here:
http://studera.nu/studera-utomlands/utbytesprogram/erasmus/
/Magnus
I'm unable to reproduce the problem from a simple embedded map using "Tools > Publish" and changing the Maps API version. I suspect there's something going on with your app that is different from that code; can you reproduce using the generated Fusion Tables publish HTML?
BTW, the code above works, but it would be cleaner to use options for style and template IDs, e.g.,
options: {
suppressInfoWindows: true,
styleId: 1,
templateId: selectedFusionTableInfoWindowTemplateId
}
The problm was finally found in our code and it was caused by a global js function called Error(). Changing the name on the function to a more specific name resolved the issue and our application started to work against google maps version 3.22 and 3.23. Our guess is that Error() function conflicted with a function with the same name in google maps js file.
Related
I'm working with GoogleMaps an GooglePlaces API but I always obtain de same error.
"The operation couldn’t be completed. An internal error occurred in the Places API library. If you believe this error represents a bug, please file a report using the instructions on our community and support page (https://developers.google.com/places/support)"
I've tried to run pod try GoogleMaps and when I launch de project any map is loaded, only a tableView with different options.
This is my code, I only want to obtain the user position:
-(IBAction)getCurrentPlace:(UIButton *)sender {
[placesClient currentPlaceWithCallback:^(GMSPlaceLikelihoodList *placeLikelihoodList, NSError *error){
if (error != nil) {
NSLog(#"Pick Place error %#", [error localizedDescription]);
return;
}
self.nameLabel.text = #"No current place";
self.addressLabel.text = #"";
if (placeLikelihoodList != nil) {
GMSPlace *place = [[[placeLikelihoodList likelihoods] firstObject] place];
if (place != nil) {
self.nameLabel.text = place.name;
self.addressLabel.text = [[place.formattedAddress componentsSeparatedByString:#", "]
componentsJoinedByString:#"\n"];
}
}
}];
}
I have imported mi APIKEY in didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[GMSServices provideAPIKey:#"MY_APIKEY"];
return YES;
}
And this is my Podfile
platform :ios, '7.0'
source 'https://github.com/CocoaPods/Specs.git'
target ‘googlePlace’ do
pod 'GoogleMaps'
pod 'GooglePlaces'
end
Finally, my apikey is configured to iOS application in Google Console.
What's the problem??
This looks like your API key is either invalid or out of quota.
Can you check that you are passing the correct API key to GMSPlacesClient.provideAPIKey(_:).
If you are sure that you are passing the correct API key check the Google API Console (https://console.developers.google.com/) to ensure you have not run over your daily quota limit.
This issue can be tracked here: https://issuetracker.google.com/issues/35830792
Answer my own question
https://developers.google.com/places/migrate-to-v2?hl=es-419
This fixed the problem
Migrating to Google Places API for iOS, version 2
With the version 2 release of the Google Maps SDK for iOS, the Google Places API for iOS has been split from the Google Maps SDK for iOS and is now distributed as a seperate CocoaPod.
Take the following steps to update your existing apps:
Update your Podfile to reference the GooglePlaces CocoaPod in addition to the GoogleMaps CocoaPod. If you are not using the Google Maps SDK for iOS, you can remove GoogleMaps.
If you are using the place picker, update your Podfile to reference the GooglePlacePicker CocoaPod in addition to GooglePlaces.
Rename GoogleMaps to GooglePlaces in all imports where you are using the Places API.
Specify your API key using GMSPlacesClient.provideAPIKey(:) instead of GMSServices.provideAPIKey(:).
Get the required open source license text using GMSPlacesClient.openSourceLicenseInfo() as well as GMSServices.openSourceLicenseInfo() if you are using the Google Maps SDK for iOS or the Place Picker.
After doing 8 to 12 hours R&D Found below solution. I am sure it will work.
Just add the key in AppDelegate.swift file, not any other class. It will solve your problem.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
GMSPlacesClient.provideAPIKey("KEY")
GMSServices.provideAPIKey("KEY")
}
Note: It is compulsory to initialize GMSPlacesClient in AppDelegate Because it will take some time for initialization.
2018 answer, well in my new job, we're having a hard time about this. My own Places key works but not my new company's Places key. After a few hours, I remember the time when I was setting my own keys, I HAD TO REFRESH or REGENERATE NEW KEYS for the Places API before I got it to work. Now back to my current situation, I told this to my colleagues and boom, we just had to refresh the key, and it worked! :)
I have already set my Google Maps' Api to accept any referrer and I am still getting a 403 error. The only reason I'm even using the key is because I'm using Fusion Tips (http://gmaps-utility-gis.googlecode.com/svn/trunk/fusiontips/docs/reference.html) so that I can have a mouse-over event (To my understanding Google Maps from Fusion Tables do not support mouse-over events natively, please correct me if I'm wrong). Is it just a fusion tips bug? If anyone could point out to me where I'm going wrong or possible solutions it would be greatly appreciated, thanks.
EDIT - I don't know if it's important but I'm building this locally
Also I've used this Fusion Table elsewhere without any problems, which leads me to believe I have a problem in my Fusion Tips implementations
Code Snippet:
var map;
var layer_1;
function initialize() {
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(33.205, -97.1325),
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
layer_1 = new google.maps.FusionTablesLayer({
suppressInfoWindows: true,
query: {
select: "col0",
from: "*Fusion Table*",
},
map: map,
styleId: 2,
templateId: 2
});
layer_1.enableMapTips({
key: "*Google Map Key that already has all referrers allowed*",
select: "JP_C",
from: "*Fusion Table",
geometryColumn: 'geometry',
delay: 200,
tolerance: 4
});
google.maps.event.addListener(layer_1, 'mouseover', function(fEvent) {
console.log("mouseover");
});
}
google.maps.event.addDomListener(window, 'load', initialize);
Error code:
error, code=403 message=Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration. reason=accessNotConfigured
The error-message "Access Not Configured" means that your key currently isn't valid for use with the Fusion Tables API. You must enable the Fusion Tables API for the particular project in the developers console.
Side note - I ended up not going with Fusion Tips because it didn't function as smoothly as I would have preferred. So instead I ended up going with the more "official" route and followed this Google example - https://developers.google.com/fusiontables/docs/samples/mouseover_map_styles - which basically has you:
Create a map
Call the Fusion Table via a query
Place the callback in the body tag
Has you control how each polygon is drawn as it is drawn (Which is what makes it the winner in my book).
It's more complicated to start out but when you walk through the example and check out how they used it for their own Fusion Table it's not too bad, and the end result is much better IMO. Hope this helps.
i believe that in google API version 2, it could eventually call this method out. Moreover they do share or happen to be using the same type of coding.
However in version 3, i could not set this layer to the map neither via "layer.setMap(map)" because this esri method does not has this function , nor "map.addOverlay(layer)" because this function belongs to version 2 which has been taken down. can i ask what is the method replacing "map.addOverlay(layer)" in version 3. i have try using custom overlay function, but is comes out as a image which doesn't match the result i want.
** take note : ArcGISDynamicMapServiceLayer is to call a time aware data layer from esri
Have a look at these examples:
http://gmaps-utility-gis.googlecode.com/svn/trunk/arcgislink/docs/examples.html
In my drupal site, I have installed the gmap module. But that is in version 2.115. Now I got a mail from google that update the google API version. I have generated the API key version 3. But no idea about implementing them to the module files.
drupal_set_html_head(' $query))) .'" type="text/javascript">');
This I changed to
drupal_set_html_head('');
Also in gmap.js
obj.map = new GMap2(elem, obj.opts); changed to obj.map = new google.maps.Map(elem, obj.opts);
But after adding this, Javascript is required to view this map. is showing.
Please help me
See this thread on d.org. There are several patches and solutions.
Hi I am Using Google Map Version 2 in my asp.net web application. now my problem is the in map area GMAPEZ is displaying and nothing else and i have no error in my XML File with valid Google Map key. What could be the problem
You declare your map type as G_MAP_TYPE on line 766 of gmapez-2.js.
var mapType = G_MAP_TYPE;
You probably want to do one of the standard map types:
https://developers.google.com/maps/documentation/javascript/v2/introduction#CommonMapTypes
I found this in a few seconds using the Chrome Developer Tools. Here's a good reference so you can do the same:
http://www.youtube.com/watch?feature=player_embedded&v=nb4gvrNrDWw