Google Maps API warning: SensorNotRequired - javascript

On the site https://gearbottle.com/ I am having an issue where the map will load my geolocation (enable geolocation to see) and then load all results (the entire world) - I need this to stay at the geolocation and not jump to the entire map.
After checking out the console I see "Google Maps API warning: SensorNotRequired //developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required" and then a dropdown of Object etc....After digging a bit i came across the following scripts that still have the sensors in place:
if(ddp('google_places_api')) { if(ddp('google_places_api') != '') { wp_register_script('google_maps_api', 'https://maps.googleapis.com/maps/api/js?key='.ddp('google_places_api').'&sensor=false&libraries=places'); } }
else { wp_register_script('google_maps_api', 'https://maps.googleapis.com/maps/api/js?'); }
}
$google_places_url = 'https://maps.googleapis.com/maps/api/place/autocomplete/xml?key='.ddp('google_places_api').'&sensor=false&input='.$fields[$field->post_name].'&types=(regions)';
$reference_url = 'https://maps.googleapis.com/maps/api/place/details/xml?key='.ddp('google_places_api').'&sensor=false&reference='.$place_reference;
....but I am clueless on what to replace the "Sensor" part in each script to or if this even matters - I really just need the map to stop jumping and that's really it.
This is an older version of a theme that has been reconstructed (purchased by choice)- there is no longer support from original devs, so I am attempting to fix things on my own.

As per the documentation on Google Map Error Codes for SensorNotRequired
The sensor parameter is no longer required for the Google Maps
JavaScript API. It won't prevent the Google Maps JavaScript API from
working correctly, but we recommend that you remove the sensor
parameter from the script element.
It is a warning and you can safely remove &sensor=false from the urls

Related

restricting context path is not working for Google Maps API in JavaScript

My original URL for an application to call Google Maps API is something like "https://example.com/abc/def" and I am trying to restrict the context path by replacing it with https://example.com/*. I have looked into so many references but nothing worked. I am facing the below error whenever I try replacing with '*' in context path.
Google Maps JavaScript API error: UnauthorizedURLForClientIdMapError
If I give whole path, then the API is loading with out any errors.

How do I resolve "port number should be an integer" error in WPF?

I am working on a WPF application that uses the built-in WebBrowser to display Bing Maps. The code can draw polygons on the map, which we are trying to export as KML using the Microsoft.Maps GeoXML module:
Microsoft.Maps.loadModule('Microsoft.Maps.GeoXml', function () {
// Pass in the map to export all data into an XML string
try {
var xml = Microsoft.Maps.GeoXml.write(map, {
xmlFormat: Microsoft.Maps.GeoXmlFormat.kml,
roundLocations: true,
indentChars: ' '
});
}
catch (e) {
alert(e)
}
However, this code gives the following error: Port number should be an integer
I have looked online and can't find anything about what this error means. The Microsoft documentation doesn't seem to require any kind of port number, and the map itself (which supposedly uses the same setup) works fine (aside from a few script errors).
Possibly helpful information
The .htm that we load into the WebBrowser is set up to call methods from a C# helper class. We also sometimes invoke the javascript methods from C#.
The actual map functions properly for the most part, but there is a script error when hovering over the dropdown to select the map type. I'm not sure if this points to a problem in our overall setup or not.
We have nearly identical javascript in our web project, and get no errors. The only difference is the callbacks to our C# class.
Attempted Fixes
I tried to get a stack trace from the error, but it was undefined.
I have used the code at this link to make sure that the web browser is using the proper version of Internet Explorer. However, I don't get these errors running the .htm in Internet Explorer.

HERE Maps script contains unsecure (mixed content) http calls

We have our site served over https, and have the HERE maps api included in some of our pages. We are currently getting Mixed content errors from this api, as I can see it is trying to load images over a xmlhttpRequest. The Map API is currently just showing a blank window, with no map information.
We are using the latest 3.0 version available (Which right now is 3.0.16.0).
Also to note, I have tried the "useHttps = true" solution in this answer: How to call HERE Maps API v3 using HTTPS. As well the documentation seems different from the time that this answer was posted so I cannot look into this rule in the current documentation.
here is the related error, with the filename containing the conflicting xmlHttpRequest: Error Picture.
Make that you are configuring H.service.Platform with the following options:
const platform = new H.service.Platform({
app_id: '{{your_app_id}}',
app_code: '{{your_app_code}}',
useHTTPS: true,
useCIT: true
});
It seems you had the wrong capitalization of useHTTPS, or were missing the useCIT property. With the above, your map should load the tiles over HTTPS.
SEE DEMO

Where to insert google map api key in wordpress theme

in my wordpress website i am getting this error for google map
Google Maps API error: MissingKeyMapError
now i have google map api key but i don't know where to insert it, i am not using google map plugin, i am using theme that contain build in google map, what i found now is the reference to google map javascript file that contain this code
var tl_geocoder;var $tl_map;var $tl_marker=false;jQuery(function(a){jQuery(document).ready(function(c){tl_geocoder=new google.maps.Geocoder();c(document).on("click",".layers-check-address",function(f){f.preventDefault();$tl_map=c(this).closest(".layers-map");var g=c(this).closest(".layers-content").find('input[id$="google_maps_location"]').val();var d=c(this).closest(".layers-content").find('input[id$="google_maps_long_lat"]').val();$tl_map.data("location",g.toString());$tl_map.data("longlat",d.toString());b(c)});b(c)});function b(d){var c=false;jQuery(".layers-map").each(function(){var h=d(this);var k=(undefined!==h.data("longlat"))?h.data("longlat"):null;if(null!==k){var l=k.split(",");var m=l[0];var e=l[1]}else{var m="-34.397";var e="150.644"}var f=new google.maps.LatLng(m,e);var j=h.data("zoom-level");$tl_map=new google.maps.Map(h[0],{scrollwheel:false,zoom:j,center:f,mapTypeId:google.maps.MapTypeId.ROADMAP});var g=!d(this).closest("div.layers-contact-widget").hasClass("no-infobox");if(undefined!==h.data("longlat")){var n=new google.maps.LatLng(m,e);$tl_map.setCenter(f);$tl_marker=new google.maps.Marker({map:$tl_map,position:n,zIndex:google.maps.Marker.MAX_ZINDEX+1,icon:TL_CONF.themeurl+"/assets/images/google-marker.png"});if(!c&&g){c=true;d("body").trigger("setInfobox")}else{$tl_marker.setMap($tl_map)}}if(undefined!==h.data("location")&&$tl_marker===false){var i=h.data("location");tl_geocoder.geocode({address:i},function(p,o){if(o==google.maps.GeocoderStatus.OK){$tl_map.setCenter((p[0].geometry.location?p[0].geometry.location:f));$tl_marker=new google.maps.Marker({map:$tl_map,zIndex:google.maps.Marker.MAX_ZINDEX+1,position:(p[0].geometry.location?p[0].geometry.location:f),icon:TL_CONF.themeurl+"/assets/images/google-marker.png"});if(!c&&g){c=true;d("body").trigger("setInfobox")}else{$tl_marker.setMap($tl_map)}}})}})}}(jQuery));
but i am still not sure where to insert google map api key
IIRC, Google maps introduced the api key usage as a recent update and the theme you're using has the older version of the api, one that does not use the api key.
You should check for an update of the theme. If it is an active one, the developer should have incorporated the api key mechanism by now so that you can provide the api key directly somewhere under the theme settings (in wp-admin).
If not, you can try with any of the available Google Maps plugins. I know for a fact that some such plugins work without an api key even today, e.g. the SiteOrigin Widgets Bundle ver. 1.6.1:
https://wordpress.org/plugins/so-widgets-bundle/developers/

Drupal 7 Gmap module - javascript error "Javascript is required to view this map."

I am using GMap module in Drupal 7. I have generated the macro code, pasted into contact page, added macro filtering to Filtered HTML text format.
It has worked correctly for about 3-4 hours and then suddenly stopped displaying google map. Instead of map I see the message "Javascript is required to view this map.".
Google maps is displayed correctly on Gmap configuration page. It does not display on the page where I added it as macro. All necessary js files seem to be loaded.
Any ideas?
Have you created API key for rendering Google map? This error usually occurs because of incorrect API key.
Try to edit the existing one or create a new API browser key in https://code.google.com/apis/console/
sitename.com
sitename.com/*
www.sitename.com
www.sitename.com/*
*.sitename.com
*.sitename.com/*
Hope this helps..

Categories

Resources