How to get latitude and longitude of center of google map - asp.net

Please tell me how can i raise event just after user change his position in google map using dragging map and get the latitude and longitude of center of google map and the miles its showing from center. i have got lots of pages on google related to it.. but not able to solve this.. please give me solution (i am using asp.net and javascript)

GEvent.addListener(map, "moveend", function() {
var center = map.getCenter();
});

You can add moveend() or dragend() event (reference) and call getCenter() method to get the new map center
Further resources to search for the links and code related to google map api is :
http://groups.google.com/group/google-maps-api

Related

How do I ImageMapType without duplicate marker

mageMapType problem with marker. They are duplicates. I'm implementing map with custom image. Drag the map to left and right, the markes are duplicates. see example: http://rafaelribeirowebmaster.com.br/zoom/_index.html
Can someone help me? thanks
This is the default-behaviour of markers, they will be repeated when the map will repeat the "world" in the viewport.
The only option I see is to create the markers by using custom overlays(these will not repeat)
Thanks a lot. I was using the library Elabel. It does something similar, but the problem was on event click. it's not worked, Then I moved the command "overlayLayer.appendChild" to "overlayMouseTarget", but I need centralize the map on point of the custom overlay.
How to do it?
google.maps.event.addListener(customOverlay, 'click', function() {
map.setCenter(customOverlay.getPosition());
})

Google Custom Streetview Panorama with custom imagemap type Map without georeferencing

I am developing a custom imagemap type map without geo referencing i.e. latlng of my map do not relate to acutal latlng of that place. Now i have also created custom streetview panoramas of certain buildings and places in that map.
The issue is am not able to integrate those custom streetview panoramas with my custom imagemap.
Following is the link to see whats going on:
http://cdi.astateweb.org/virtual_tour/
First Approach:
There are two markers on the map right now. When you click on them a small infobubble pops up. Now when you click on the virtual tour link a dialog comes up. I want to load the custom streetview panorama in that dialog. I tried several things but to no avail. I am trying to reuse the same dialog for both markers. I tried initializing the panorama in jquery ui dialog open function. It worked for the first one but when you close the dialog and open it again it fails with some cbk error from google apis.
SECOND APPROACH:
I tried to use the default streetview pegman such that when the pegman is dropped on a certain building or place which has a panorama the streetview comes up just like in normal google maps. This didn't work either.
Can somebody point me to the right direction. Any help will be highly appreciated.
Thanks
Ok, try like this:
Change at line 41
from
'Virtual Tour'
to
'Virtual Tour'
Change at line 96
$("#dialog").dialog({
autoOpen: false,
width: 650,
open: function() {
console.log($("#" + virtualTour.currentPano));
$("#" + virtualTour.currentPano).appendTo("#dialog").css("display", "block");
},
close: function() {
$("#" + virtualTour.currentPano).appendTo("body").css("display", "none");
}
});
And the below code to add into "createMarker" function.
//After this line.
virtualTour.hotspotArray.push(marker);
//Add this code.
setTimeout(function(){
document.getElementById(pano).style.display = "none";
}, 100);

Opening a Google Maps API infowindow from URL parameter (KML layer)

I have a Google Map that loads a layer of markers from a KML file. Each placemark has an ID (simply id="1" through id="25").
Is it possible to open a specific placemark's infowindow from a URL parameter? If so, how?
The idea is that an address on another page is linked to its corresponding placemark http://MAPURL.COM/?id=4 or something.
Here's a jsfiddle to see the whole thing in action:
http://jsfiddle.net/natejones/JAyCF/3/
Thanks!
Your customization options are really limited using a KML Overlay. As far as I know there's no way to open a KML marker's InfoWindow without going through and clicking on the marker; the InfoWindow isn't always loaded in many cases until the KmlLayer's click event is fired.
I'd suggest using native marker elements (google.maps.Marker) which would easily let you trigger an InfoWindow's open event.

How do I close InfoBubble? (google maps utility library v3)

I'm working with google maps utility library. More specifically with infoBubble, and I'm currently able to open an InfoBubble for a Marker, placed on my google map. What I want to know is how to attach an event to close that infoBubble. I'm struggling with this. Please help me.
Sincerely,
J
// Listen for user click on map to close any open info bubbles
google.maps.event.addListener(map, "click", function () {
infoBubble.close();
});
In the infobubble options simply write hideCloseButton: false,.
You will be able to see a close button on the right top corner of the infobubble
or add an event as DeeZone's answer has shown.

how to close/toggle visibility of the street view in a custom google map API v3?

i built a custom map using google api v3, and I allow my users to use the streetview feature, but i would be able to close it and go back to the regular map by clicking a button (not he X within th emap but my own button)...what's the command to do that? i cant find it in the docs
Try putting this under the pageLoad()
$("#streetview_click").appendTo("#map_canvas");
// google streetmap [top bar (north) ]
$("#streetview_click").click(function(){
var panorama = map.getStreetView();
if(panorama){panorama.setVisible(false);}
});
for more information about streetview script functions check this topic on Google groups:
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/d87b18de3a096b8d/b56a04a0440f5016?lnk=gst&q=streetview+close+button#b56a04a0440f5016

Resources