I have a problem with a map that contains a geo-location, directions and markers. The map is the start screen which is directly shown after the app launches. I want the map to show geolocation (position) and markers, but i have to reload it (ripple emulator), to see what i want. After the app launches, the map is clear and no geolocation or markers are shown.
I think the script may not load to 100%, sometimes it works without giving me this problem.
I use cordova, initialize the map in this classic way bottom script:
google.maps.event.addDomListener(window, 'load', initialize);
and to call :
<div id="map-canvas"></div>
API and script and I put the code on the top of the page.
Apparently it does not work at all, in the device map does not load the function or disappear when you "zoom " and runs very slowly
Related
I´m working on a google maps implementation and it works fine so far. To try things and play around with it I made an extra file for that.
Here you can checkout the map: Google maps file
I have everything ready in that file and I want to implement that to my website. I took the code and copied it to my "main-file".
Now, the google-map won´t load in the first place, only if I resize the browser or write something in the text field.
The browser doesn´t give me any errors back.
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=YOURAPIKEY&callback=initMap&language=de">
This Code-Sample is on the end of my <body>-tag. I know that google-map needs to load async, but I´m not realy sure what it is, because - I´m a beginner...
Can anyone give me a hint why the map is acting like that?
All javascript-files that are needed are implemented.
Google maps seem to be showing without resizing the window though.
If it's not showing, try adding "resize" event trigger on map load. It is the same event for window resizing.
function initMap() {
var map = new google.maps.Map(document.getElementById('newjobmap'), options);
google.maps.event.trigger(map, "resize");
}
I have this site here that I built for a client but the Google Maps API is not working correctly. If you go to the site, click the contact us link in the nav bar. You will see the map not showing, then if you just reload the page two or three times the map will show.
I copied and pasted the exact link from Google into my HTML file, with the API key that they gave me. I also borrowed a file called gmaps.js, which you can search for on Google, and implemented the map in my javascript file with the following code:
/* MAPS */
new GMaps({
div: '.map',
lat: 42.2803784,
lng: -83.7301047
});
The github repo is public and can be viewed here:
https://github.com/seanrobenalt/cosasabrosa
The problem doesn't seem to be too complicated but I can't figure it out. Hoping somebody is willing to take a look...
I am working on a website that uses Google Maps but I can't get the map to show on Firefox. I am using this basic code to initialize the map.
function initialize()
{
var mapProperties = {
center:new google.maps.LatLng(33.9000,35.5333),
zoom:5,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
googleMap = new google.maps.Map(document.getElementById("mapDiv"),mapProperties);
googleMap.addListener('click', function()
{
if(infowindow!=null)
infowindow.close();
});
}
The function initialize is called when the page loads.
In the document head, I am including this script:
<script type='text/javascript' src='http://maps.googleapis.com/maps/api/js'></script>
The map works fine in google chrome and internet explorer, but is invisible in firefox. In firefox, the div containing the map ("mapDiv") seems to be initialized with the map content when I inspect the html, but the div is transparent and the map doesn't show.
I have tried clearing the cache and starting firefox without plugins in safe mode but the issue remains. I appreciate any help in advance. Thank you
Thanks to all who replied. The issue has been solved. The problem was that I had my map div inside a table cell but the table cell did not have a height set. After setting a height of 100% to the the table cell, the map shows properly.
Also check if firefox browser privacy tracking is unchecked. This feature in firefox 42 onwards prevents display of maps which otherwise display in chrome and IE. I dont know why map display code should affect tracking in firefox. What worked for me in firefox 48.0 was to disbale tracking. Go to menu - options which opens about:preferences page. In Privacy uncheck tracking. These mindless browser updates developer do not apply their mind.
I was having this problem, map was only appearing in Chrome. I added to src= the tag &sensor=true -- example:
src="http://maps.googleapis.com/maps/api/staticmap?center=Tombouctou,Mali&zoom=12&size=350x350&sensor=true"
Now it appears in both Chrome and Firefox.
I'm developing an app whit phonegap (cordova). This app includes a google map with some markers.
The app also has more pages as a list of comerces…
The map shows correctly, but when I change the page, and back to the map page, sometimes the map is displaced and the info windows not open correctly.
Is there any way to put a map and it appears correctly when changing pages?
And I have also seen that the map consuming a lot internet data.
Could someone make me a suggestion?
I hope someone can help me!!
Thanks, and excuse me for my bad english.
I had similar problems with google maps and cordova. I was using jquery-mobile and sometimes if you switch between pages the maps wasn't loaded properly. You can check out different page events and try to "resize" the maps. I was also playing with different version of cordova and jquery-mobile. This could help as well.
$(document).on("pagebeforeshow","#pagetwo",function(){
google.maps.event.trigger(map, 'resize');
});
best
M
I am following this link to create Adsense on GMAP https://developers.google.com/maps/documentation/javascript/examples/ads-adunit
But when i implemented it on my website only ads and some part of MAP only highlighted, I also tried to debug the view from the firebug tool but not found any hidden property or error. The same code i have implemented.
pastebin.com/AbEEExSa
Since it shows grey color in the map-canvas, it seems to be a refresh problem. This can be solved by triggering the resize of the Google maps.
google.maps.event.trigger(map, "resize");
Try adding this line after the completion of adunit API(success callback of this API).
FYI:
resize : Developers should trigger this event on the map when the
div changes size: google.maps.event.trigger(map, 'resize').
Updates:
I tried using the code that you have pasted in codebin, removing the php and parts that you have commented. It is working. I'm not sure what your php code does. So try debugging like in the fiddle.