Google Maps V3 not working - google-maps

I'm trying to update our journey planner to use Google Maps V3. I didn't write the original code and am struggling to get it to work. I'm hoping someone can help.
The working old v2 page can be seen here
http://www.connectteesvalley.com/jplanner1.asp
I'm trying to implement v3 on a test page here
http://www.connectteesvalley.com/jplanner1testing.asp
The map displays, which is great. And I have checked numerous times for any functions which aren't now usable in v3, but when I click the "begin my journey"-button it doesn't advance, are there any debuggers out there that could help me pinpoint the erroneous code? As it stands I'm not sure where it is actually failing.
IE Debugger is throwing up an error here
function removeMarker(markerID){
var len = markersArr.length;
for(i=0;i<len;i++){
if (markerID.toLowerCase() == markersArr[i].id.toLowerCase()){
markersArr[i].remove();
}
}
}
saying Object doesn't support property or method 'remove'
however i've looked around here and its used quite often.
Thanks

As you found out by yourself, you need to use setMap(null). Regarding your problem with marker.setImage(imageUrl), you need to use marker.setIcon() instead.

Related

react-native-maps first person view

I am using react-native-maps library with expo to render google maps for android and ios.
At some point, I need to render map in first person view mode, something like this:
I've read react-native-maps documentation and searched github and stackoverflow questions to get an answer but wasn't able to find any.
Can I achieve this using this library?
EDIT:
After many research, I've found #1544 which allows us to rotate map, change view angle, etc.
But there is one little problem, functions animateToBearing and animateToViewingAngle are still working fine, but they are deprecated. And new function animateCamera leads me to another problem

Remove Google Map Marker Text

I have a client who has embedded Google Maps showing the location of a new hospital they are building. Until recently it just showed the pin marker, however now it is showing the longitude and latitude next to the pin. I have tried everything to remove this text but none of the options in the query string appear to do anything.
I think Google has updated the embed code but I can't find any documentation about it though. Does anyone have any suggestions?
Thanks
John
From the research I did, it seems like the new Google maps is pretty rigid and there isn't really a simple way. I think it would require some more complex API stuff.
This is the post that I found that described the limitations Removing the info window from an embedded map in the new Google Maps
Sorry I realize that doesn't really help.

Determine if all markers are displayed on a Google Map V3 using MarkerClusterer

I'm using Google Maps' MarkerClusterer to cluster my numerous markers.
Everything works fine, but I'd like to know if it is possible to know if, at a certain zoom level, all markers are displayed.
Example :
Here, I'd like my program answers "No, all markers are not displayed"
But here (after some zooms), I'd like the program answers "Yes, all markers are displayed"
I can't find any function answering my needs in the doc linked above.
Is it possible ? If yes, do anyone give me a sample of code, or a clue ?
Thanks a lot
If my understanding of the MarkerClusterer code and documentation is correct, I think you could just use the getTotalClusters() function, which in your second example I believe should return zero.

Google map customizations

i'm new to gooogle map developing.i want to make a map as follows.
http://edition.cnn.com/SPECIALS/world/arab-unrest/index.html
But i have no idea how to start this development.Could someone please tell me the way to do this? If you have any worked through examples, that would be a real help!
If you haven't, I recommend you start with Google Maps API Tutorial on http://econym.org.uk/gmap/
First of all - do you want replace the images for maps? If so, you've got troubles - no one is going to make that, and Google maps are provided as is.
If you simply want to add some layers with animation - try to read the docs about overlays.
i found this link.this is will be helpful for others.
http://www.wolfpil.de/

Google Maps API GroundOverlay Complete Event

is there a way to, w/ google maps v3, listen to an event that will indicate a groundoverlay asset has been loaded? I'm loading an image onto the map and would like to be notified when the asset has completed downloading and has been presented to the client. Any ideas?
As of 2021 Dec, I can confirm that #Trott idle event will NOT work at all.
idle event fired early before any ground overlay image even start loading.
see this example
https://transparentgov.net:3200/googlemaps111/default?layer_id=7&layer=Zoning_Merge&center_lat=33.721999270778305&center_long=-116.28975468931803&center_zoom=17&url=https%3A%2F%2Fgis.la-quinta.org%2Farcgis%2Frest%2Fservices%2FPlanning%2Fzoning1%2FMapServer&panto=0
However, in another post, I post a working example
The idea is you need use create a html image object,
new Image()
then set source let it downloading image
image.src
Then attach event
image.onload = function
The whole working source code is here
The working example is here
https://transparentgov.net:3200/googlemaps12/default?layer_id=0&layer=SilverRock_MasterPlan_29Nov2016_s200-images.jpg&center_lat=33.65789936781538&center_long=-116.25862990762825&center_zoom=15&url=https%3A%2F%2Fgis.la-quinta.org%2Farcgis%2Frest%2Fservices%2FCommunity_and_economic%2FSilver_Rock_Master_Plan%2FMapServer&panto=0&overlayOpacity=8&overlayType=overlayType_image
A straight reading of the Google Maps API v3 documentation would seem to suggest that this wouldn't work, but I've managed to do this using the idle event with addListenerOnce(). (If that doesn't work for you, edit your question to show the code you tried and we'll see if we can get it working.)
The idle event seems to fire exactly once as a way of sort of saying "map is loaded and ready to go" even though the documentation seems to suggest that a pan or zoom needs to happen to trigger it.
Since this is (to my knowledge) undocumented behavior (at least in any official documentation), it runs the risk of suddenly not working one day when the API is updated. You can make the choice to either live with that risk or try to guard against it by specifying the version of the API that you want in your <script> tag that loads the API.