I am using the Google Maps Control for ASP.Net. I am adding one point which is current point of bus & polyline of the points from current point to last 10 points on the page load with showing popup on current point by default.
I am using update panel for the the refresh button. There is also one input field which takes number of record to show on polyline from current point. Now I want to reset my googlemapObject on refresh button click event so that in every refresh click completely new set of points, polylines should add and shown on google map.
Is there is any method like dispose to dispose current object of goolemap.
How to resolve this problem?
Regards,
Girish
I'm assuming that you are using the Google Maps Control for ASP.NET found at:
http://en.googlemaps.subgurim.net/
If that is the case - there is an example found on their site that will walk you through how to erase icons that are added to the map.
The sample code can be found right here:
http://en.googlemaps.subgurim.net/ejemplos/ejemplo_99000_Custom-Javascript.aspx
By implementing a custom Javascript Event you will be able to change the data on your map with the refresh button - without needing to do a whole page refresh.
Related
Problem 1: In my project, I have to add the route of a person. for that I have two drop-down from that I can choose the location then add that to my route map by clicking another button called 'ADD'. each time I click 'ADD' after selecting the trips the trip should append the existing route map as shown in the image.
I searched on google but I couldn't find any solution. all are talking about adding line route in google map
Problem 2: we can add Any number of trips, the design should respond accordingly to adjust within the defined dimension.
Am trying to display the locations in map which i have in my array i have listed the locations on the left side. if user click any of the locations on the list the map should display that particular location and info Window. The problem here is if i click on any other location the previous clicked info Window still appears on the map how can i hide it in the map?
My code
you are creating a new infoWindow instance every time you click one of those locations and not saving them for further use.
i have modified your code inside two functions
1. populateInfoWindow
(added condition here to check if there is an infoWindow created already,
if yes then use that else create new and save it under the same marker)
2. showListings
(if marker visibility is false then call close function of its infoWindow)
working CodePen
I've got a tile layer that I want to remove and replace with another one in Google Maps. My tile layer is defined in MapOptions using GetTileUrl to call a function.
For instance, I want to be able to remove a county layer and replace it with a census tract one.
When I try to do this it only loads the new layer when I pan the map. I think I need to remove the old tiles from Google's cache (as if I turn browser caching turned off this still happens).
I've tried the map "resize" event, but it doesn't work.
Do I need to set the map to null and reinitialize everything? Or can I just reload my map tile layer?
When I change the layer, the URL for the tile loading changes - so I'm guessing that adding a fake parameter won't help me.
The code is pretty long (and has extra stuff in it), but if you want to see this in action you can go to JusticeMap.org
var jmapMapType = new google.maps.ImageMapType(jmapTypeOptions);
map.overlayMapTypes.push(jmapMapType);
I needed to store the jmapMapType in a global variable.
Then I can remove it, and add it back. This reloads the tiles:
map.overlayMapTypes.removeAt(0);
map.overlayMapTypes.push(jmapMapType);
I have google maps embedded in my website. Its has markers and when clicked, it displays the property information at the position. (infobox).
Now the user wants the following functionality:
I search for a place , the map displays the place with properties. After I drag the map and get some other property, I would like to share this one to some body. can I get a link
to share the dragged position?
I know we can get the link in maps.google.com . It changes whenever we drag.
But how to do it in our website?
Is there a way in google maps api to get that link?
Listen to events on the Map
The idle event is particully useful, but can use say bounds_changed to get events while dragging (or even the drag event itself!).
In that event update whatever link you are talking about.
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¢er_lat=33.721999270778305¢er_long=-116.28975468931803¢er_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¢er_lat=33.65789936781538¢er_long=-116.25862990762825¢er_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.