TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthika pommudu
NA
321
34.6k
Get address from latitude & longitude
Mar 14 2019 6:57 AM
Help to find,how can I show the address dynamic in infowindow (when marker click)
I have to include the Latitud& longitude,but because of loop its shows only one address for all marker,but here i need to display specific address for individual marker
var
infoWindow =
new
google.maps.InfoWindow();
var
geocoder;
var
map;
var
i,j;
var
js_lats = [
'11.798880'
,
'13.0826802'
,
'12.975444'
];
var
js_longs =[
'77.827760'
,
'80.2707184'
,
'80.220642'
];
if
(js_lats.length>0)
{
for
(i = 0; i < js_lats.length; i++) {
var
latlng =
new
google.maps.LatLng(js_lats[i],js_longs[i]);
var
geocoder = geocoder =
new
google.maps.Geocoder();
geocoder.geocode({
'latLng'
: latlng },
function
(results, status) {
if
(status == google.maps.GeocoderStatus.OK) {
if
(results[1]) {
loc= results[1].formatted_address;
geocoder =
new
google.maps.Geocoder();
var
mapOptions = {
zoom: 10
}
var
geocode = document.getElementById(
'address1'
).value;
map =
new
google.maps.Map(document.getElementById(
'dvMap'
), mapOptions);
geocoder =
new
google.maps.Geocoder();
document.getElementById(
"dis"
).setAttribute(
'style'
,
'visibility:visible;'
);
geocoder.geocode( {
'address'
: loc},
function
(results, status)
{
map.fitBounds(results[0].geometry.viewport);
var
icon =
"Markers/letter_m.png"
;
var
infoWindow =
new
google.maps.InfoWindow();
if
(status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var
marker =
new
google.maps.Marker({
map: map,
position: results[0].geometry.location
});
var
loc1 = loc;
(
function
(marker){
google.maps.event.addListener(marker,
"click"
,
function
(e) {{
infoWindow.setContent(
"<span class='lm_loc_detail_trk'>Location :</span><span class='lm_addr_detail_trk'>"
+loc1+
"</span></div>"
);
infoWindow.open(map, marker);
}});})(marker);
var
listener = google.maps.event.addListener(map,
"idle"
,
function
() {
map.setZoom(6);
google.maps.event.removeListener(listener);
});
}
else
{alert(
'Geocode was not successful for the following reason: '
+ status);
}
});}}});}}
Reply
Answers (
2
)
Regarding Responsive Table.
how to get xml parse value in loop..