google maps api v2 map.removeOverlay() marker array issue - api

To start off with, I would like to say that I have been looking on the internet for a really long time and have been unable to find the answer, hence my question here.
My latest school project is to create an admin page for adding articles to a database, the articles are connected to a point on a google map. The requirement for adding the point on the map is that the user is able to click the map once and the marker is produced, if the map is clicked a second time the first marker is moved to the second location. (this is what I am struggling with.)
The problem is, as the code is now, I get the error that markersArray is undefined. If I place the var markersArray = new Array; underneath the eventListener then I get an error that there is something wrong the main.js (googles file) and markersArray[0] is undefined in the second if.
By the way, I have to use google maps API v2, even though it is old.
<script type="text/javascript">
//<![CDATA[
var map;
var markers = new Array;
function load() {
if (GBrowserIsCompatible()) {
this.counter = 0;
this.map = new GMap2(document.getElementById("map"));
this.map.addControl(new GSmallMapControl());
this.map.addControl(new GMapTypeControl());
this.map.setCenter(new GLatLng(57.668911, 15.203247), 7);
GDownloadUrl("genxml.php", function(data) {
var xml = GXml.parse(data);
var Articles = xml.documentElement.getElementsByTagName("article");
for (var i = 0; i < Articles.length; i++) {
var id = Articles[i].getAttribute("id");
var title = Articles[i].getAttribute("title");
var text = Articles[i].getAttribute("text");
var searchWord = Articles[i].getAttribute("searchWord");
var point = new GLatLng(parseFloat(Articles[i].getAttribute("lat")),
parseFloat(Articles[i].getAttribute("lng")));
var article = createMarker(point, id, title, text);
this.map.addOverlay(article);
}
});
}
var myEventListener = GEvent.bind(this.map,"click", this, function(overlay, latlng) {
if (this.counter == 0) {
if (latlng) {
var marker = new GMarker(latlng);
latlng1 = latlng;
this.map.addOverlay(marker);
this.counter++;
markers.push(marker); //This is where I get the error that markersArray is undefined.
}
}
else if (this.counter == 1) {
if (latlng){
alert (markers[0]);
this.map.removeOverlay(markers[0]);
var markers = [];
this.map.addOverlay(marker);
this.counter++;
}
}
});
}
function createMarker(point, id, title, text) {
var article = new GMarker(point);
var html = "<b>" + title + "</b> <br/>"
GEvent.addListener(article, 'click', function() {
window.location = "article.php?id=" + id;
});
return article;
}

I solved the problem. I'm not exactly sure why it worked but this is what it looks like now:
var markersArray = [];
function load() {
if (GBrowserIsCompatible()) {
this.counter = 0;
this.map = new GMap2(document.getElementById("map"));
this.map.addControl(new GSmallMapControl());
this.map.addControl(new GMapTypeControl());
this.map.setCenter(new GLatLng(57.668911, 15.203247), 7);
GDownloadUrl("genxml.php", function(data) {
var xml = GXml.parse(data);
var Articles = xml.documentElement.getElementsByTagName("article");
for (var i = 0; i < Articles.length; i++) {
var id = Articles[i].getAttribute("id");
var title = Articles[i].getAttribute("title");
var text = Articles[i].getAttribute("text");
var searchWord = Articles[i].getAttribute("searchWord");
var type = Articles[i].getAttribute("type");
var point = new GLatLng(parseFloat(Articles[i].getAttribute("lat")),
parseFloat(Articles[i].getAttribute("lng")));
var article = createMarker(point, id, title, text);
this.map.addOverlay(article);
}
});
}
var myEventListener = GEvent.bind(this.map,"click", this, function(overlay, latlng) {
var marker = new GMarker(latlng);
if (this.counter == 0) {
if (latlng) {
latlng1 = latlng;
this.map.addOverlay(marker);
markersArray.push(marker);
this.counter++;
}
}
else if (this.counter == 1) {
if (latlng){
this.map.removeOverlay(markersArray[0]);
this.map.addOverlay(marker);
this.counter++;
}
}
});
}
function createMarker(point, id, title, text) {
var article = new GMarker(point);
var html = "<b>" + title + "</b> <br/>"
GEvent.addListener(article, 'click', function() {
window.location = "article.php?id=" + id;
});
return article;
}

Related

Responsive datatables handle row click

I'm using a responsive datatables on which I'm trying to handle click on a row, so you get redirected to a new page if you click on the row. This works fine, but if the table is collapsed I cannot show the child row, since clicking on the expand icon activates the row click and I get redirected.
So I'm trying to see if I can check whether the icon is clicked or not, but I cannot figure out how to do it
I have tried to use
$("#jobListTable").hasClass('collapsed')
in order to see, if the table is collapsed or not, but I still miss how to check what cell i clicked
Simplyfied fiddle can be found here: http://jsfiddle.net/Anja_Reeft/agouq6ts/5/
But my actually code is
$('#jobListTable tbody').on('click', 'tr', function (e) {
var data = oTable.row( this ).data();
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
var selectedTaskID = data.taskID;
var selectedJobNumber = data.jobNumber;
var selectedReqno = data.reqno;
var selectedPriority = data.priority;
var selectedCreatedBy = data.createdBy;
var selectedEmployeeInitials = data.employeeInitials;
var selectedShortDescription = data.shortDescription;
var selectedLongDescription = data.longDescription;
var selectedSourceReference = data.sourceReference;
var selectedAktivitetstype = data.aktivitetstype;
var selectedDueDatetime = data.dueDatetime;
var selectedRecurrence = data.recurrence;
var selectedStatus = data.status;
var selectedStatusColor = encodeURIComponent(data.statusColor);
var teamID = "";
if (sessionStorage.getItem("teamID")) {
teamID = "&teamID="+sessionStorage.getItem("teamID");
}
document.location.href="jobinfo.php?taskID="+selectedTaskID+"&jobNumber="+selectedJobNumber+"&reqno="+selectedReqno+"&priority="+selectedPriority+"&createdBy="+selectedCreatedBy+"&employeeInitials="+selectedEmployeeInitials+"&shortDescription="+selectedShortDescription+"&longDescription="+selectedLongDescription+"&sourceReference="+selectedSourceReference+"&aktivitetstype="+selectedAktivitetstype+"&dueDatetime="+selectedDueDatetime+"&recurrence="+selectedRecurrence+"&status="+selectedStatus+"&statusColor="+selectedStatusColor+teamID;
} );
Please let me know if you need futher information.
In cases anyone has a simular problem:
I changed my code so I added a button to each row
"columns": [
{
data: null, // can be null or undefined
defaultContent: '<button type="button" id="jobInfoBtn" class="btn btn-sm"><i class="fa fa-info-circle" aria-hidden="true"></i></button>',
},
and then changed my on click function
$('#jobListTable tbody').on('click', 'tr', function (e) {
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
oTable.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
} );
$('#jobListTable tbody').on('click', 'button', function (e) {
var data = oTable.row( $(this).parents('tr') ).data();
var selectedTaskID = data.taskID;
var selectedJobNumber = data.jobNumber;
var selectedReqno = data.reqno;
var selectedPriority = data.priority;
var selectedCreatedBy = data.createdBy;
var selectedEmployeeInitials = data.employeeInitials;
var selectedShortDescription = data.shortDescription;
var selectedLongDescription = data.longDescription;
var selectedSourceReference = data.sourceReference;
var selectedAktivitetstype = data.aktivitetstype;
var selectedDueDatetime = data.dueDatetime;
var selectedRecurrence = data.recurrence;
var selectedStatus = data.status;
var selectedStatusColor = encodeURIComponent(data.statusColor);
var teamID = "";
if (sessionStorage.getItem("teamID")) {
teamID = "&teamID="+sessionStorage.getItem("teamID");
}
document.location.href="jobinfo.php?taskID="+selectedTaskID+"&jobNumber="+selectedJobNumber+"&reqno="+selectedReqno+"&priority="+selectedPriority+"&createdBy="+selectedCreatedBy+"&employeeInitials="+selectedEmployeeInitials+"&shortDescription="+selectedShortDescription+"&longDescription="+selectedLongDescription+"&sourceReference="+selectedSourceReference+"&aktivitetstype="+selectedAktivitetstype+"&dueDatetime="+selectedDueDatetime+"&recurrence="+selectedRecurrence+"&status="+selectedStatus+"&statusColor="+selectedStatusColor+teamID;
} );

Saving data from XMLHttpRequest Response to my IndexedDB

I have created a json file containing my Sql Server datas. With the XmlHttpRequest's GET method, I am reading json file and iterating and saving those records to my IndexedDB.. Everything is working fine.. After the end of the iteration, I wrote a code to alert the user.. But the alert message is displayed very quickly, but when I see it in the console window, the saving operation is till processing.. I want to alert the user, only after the operation is completed..
My code is,
if (window.XMLHttpRequest) {
var sFileText;
var sPath = "IDBFiles/Reservation.json";
//console.log(sPath);
var xhr = new XMLHttpRequest();
xhr.open("GET", sPath, 1);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
if (xhr.responseText != "") {
sFileText = xhr.responseText;
//console.log(sFileText);
var val = JSON.parse(sFileText);
var i = 0;
var value = val.length;
for(var i in val)
{
var code = val[i].RTM_res_category_code;
var desc = val[i].RTM_res_category_edesc;
addReserv(code, desc);
}
if(i >= value-1) {
console.log("Reservation Load Completed... "+i);
document.getElementById("status").innerHTML = "Reservation Loading Success...";
}
}
}
}
xhr.send();
}
//Passing Parameters to Reservation
function addReserv(code, desc)
{
document.querySelector("#status").innerHTML = "Loading Reservation.. Please wait...";
var trans = db.transaction(["Reservation"], "readwrite");
var store = trans.objectStore("Reservation");
//console.log(store);
var reserv={ RTM_res_category_code : code, RTM_res_category_edesc : ''+desc+'' };
var request = store.add(reserv);
request.onerror = function(e) {
console.log(e.target.error.name);
document.querySelector("#status").innerHTML = e.target.error.name;
}
request.onsuccess = function(e) {
console.log("Reservation Saved Successfully.");
//document.querySelector("#status").innerHTML = "Reservation Loaded Successfully.";
}
}
Thanks for the question.
What you are currently doing works, but the alert comes to soon because of the async nature of the IDB.
What you should to avoid this.
1. Create your transaction only once.
2. Do all your operations in this one transaction.
3. The transaction object has an oncomplete callback you can use to notify the user.
Concrete on your example. Instead of looping over the items in the ajax callback, pass the collection to your add method and loop there
if (window.XMLHttpRequest) {
var sFileText;
var sPath = "IDBFiles/Reservation.json";
//console.log(sPath);
var xhr = new XMLHttpRequest();
xhr.open("GET", sPath, 1);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
if (xhr.responseText != "") {
sFileText = xhr.responseText;
//console.log(sFileText);
var val = JSON.parse(sFileText);
import(val);
}
}
}
xhr.send();
}
function import(values)
{
document.querySelector("#status").innerHTML = "Loading Reservation.. Please wait...";
var trans = db.transaction(["Reservation"], "readwrite");
var store = trans.objectStore("Reservation");
var i = 0;
var value = val.length;
for(var i in val)
{
var code = val[i].RTM_res_category_code;
var desc = val[i].RTM_res_category_edesc;
var reserv={ RTM_res_category_code : code, RTM_res_category_edesc : ''+desc+'' };
var request = store.add(reserv);
request.onerror = function(e) {
console.log(e.target.error.name);
document.querySelector("#status").innerHTML = e.target.error.name;
}
request.onsuccess = function(e) {
console.log("Reservation Saved Successfully.");
//document.querySelector("#status").innerHTML = "Reservation Loaded Successfully.";
}
}
trans.oncomplete = function () {
console.log("Reservation Load Completed... "+i);
document.getElementById("status").innerHTML = "Reservation Loading Success...";
}
}

how to to process result of google distance matrix api further?

i am new to programming.. i have this code which gives distance between two points but need to further multiply it by an integer say 10.. the project i am working on is abt calculating distance between two points and multiplying it with fare/Km like Rs.10/km (Indian Rupees) for the same. So if the distance is 30 km the fare would be 30*10 = Rs.300
Thanks in advance
following is the code
<script>
var map;
var geocoder;
var bounds = new google.maps.LatLngBounds();
var markersArray = [];
var origin1 = '';
var destinationA = '';
var destinationIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=D|FF0000|000000';
var originIcon = 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=O|FFFF00|000000';
function initialize() {
var opts = {
center: new google.maps.LatLng(55.53, 9.4),
zoom: 10,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map'), opts);
var fromText = document.getElementById('FAdd');
var options = {
componentRestrictions: {country: 'in'}
};var fromAuto = new google.maps.places.Autocomplete(fromText, options);
fromAuto.bindTo('bound', map);
var toText = document.getElementById('TAdd');
var toAuto = new google.maps.places.Autocomplete(toText, options);
toAuto.bindTo('bound', map);
geocoder = new google.maps.Geocoder();
}
function calculateDistances() {
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [document.getElementById("FAdd").value],
destinations: [document.getElementById("TAdd").value],
travelMode: google.maps.TravelMode.DRIVING,
unitSystem: google.maps.UnitSystem.METRIC,
avoidHighways: false,
avoidTolls: false
}, callback);
}
function callback(response, status) {
if (status != google.maps.DistanceMatrixStatus.OK) {
alert('Error was: ' + status);
} else {
var origins = response.originAddresses;
var destinations = response.destinationAddresses;
var outputDiv = document.getElementById('outputDiv');
outputDiv.innerHTML = '';
deleteOverlays();
for (var i = 0; i < origins.length; i++) {
var results = response.rows[i].elements;
addMarker(origins[i], false);
for (var j = 0; j < results.length; j++) {
addMarker(destinations[j], true);
outputDiv.innerHTML += results[j].distance.text + '<br>';
}
}
}
}
function addMarker(location, isDestination) {
var icon;
if (isDestination) {
icon = destinationIcon;
} else {
icon = originIcon;
}
geocoder.geocode({'address': location}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
bounds.extend(results[0].geometry.location);
map.fitBounds(bounds);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: icon
});
markersArray.push(marker);
} else {
alert('Geocode was not successful for the following reason: '
+ status);
}
});
}
function deleteOverlays() {
if (markersArray) {
for (i in markersArray) {
markersArray[i].setMap(null);
}
markersArray.length = 0;
}
}
</script>
I use an Ajax call to PHP, and haven't yet used getDistanceMatrix(), but this should be an easy fix.
First, if you know you will always only have one origin and one destination, you don't need the "for" loop in your callback function. Second, you're taking the distance text rather than the distance value.
function callback(response, status) {
if (status != google.maps.DistanceMatrixStatus.OK) {
[...]
} else {
deleteOverlays();
var outputDiv = document.getElementById('outputDiv'),
origin = response.originAddresses[0],
destination = response.destinationAddresses[0],
result = response.rows[0].elements[0],
distance = result.distance.value,
text = result.distance.text,
price = 10 * distance;
outputDiv.innerHTML = '<p>' + text + ': Rs.' + price + '</p>';
addMarker(origin, false);
addMarker(destination, false);
}
}
I haven't tested this, so it probably needs to be tweaked. ( See https://developers.google.com/maps/documentation/distancematrix/#DistanceMatrixResponses )

Google Places API (get all postal code around me)

I am using the blowing script to get all store around position wit 20 mile and working well but when try to using it to get postal_code do not working
how i get all postal code around center with specific distance
code:
<script type="text/javascript" language="javascript">
var lat = "";
var lng = "";
function latClick(glocation) {
var a = new google.maps.Geocoder();
a.geocode({ 'address': glocation }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK)
var c = results;
else
c = "We couldn't find that location. Please try again."
lat = c[0].geometry.location.lat();
lng = c[0].geometry.location.lng();
var pyrmont = new google.maps.LatLng(lat, lng);
//sll=30.04443,31.234217&sspn=0.036703,0.084543&geocode=FU1wygEdO5jcAQ%3BFQRxygEdgJ7cASnrviELpj9YFDG6O0LolrLfeQ&mra=mift&
map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: pyrmont,
zoom: 15
});
var request = {
location: pyrmont,
radius: 200,
types: ['store']
};
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.nearbySearch(request, callback);
});
}
var map;
var infowindow;
function initialize() {
latClick("Jersey City, NJ 07306, United States");
}
function callback(results, status) {
var x = "";
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
x = x + results[i].name + ", ";
}
alert(x);
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>

Plotting Points with the Google Maps API

I have a project where the client is looking to be able to create an outline around a specific area on a Google Map and have it clickable with the standard Google Maps info window.
So rather than just a standard point being plotted at a specific lat and long location it would need to create multiple points and a stroke/outline.
Does anyone know if this is even possible with the Google Maps api?
Thanks.
Sample code:
toggleCommentMode(true);
function toggleCommentMode(isCommentMode){
if(isCommentMode){
//$("#map img").css("cursor", "crosshair !important");
commentModeEventListener = google.maps.event.addListener(FRbase, 'click', commentListener);
}
else{
//$("#map img").css("cursor", "auto !important");
google.maps.event.removeListener(commentModeEventListener);
}
}
//}}}
function commentListener(evt){
var newMarker = new google.maps.Marker({
position: evt.latLng,
draggable : true,
title : "Drag me; Double click to remove",
map : map
});
google.maps.event.addListener(newMarker, 'dragend',function(){
updateMarkerList();
});
google.maps.event.addListener(newMarker, 'dblclick',function(){
$(myMarkers["userComment"]).each(function(i,marker){
if(marker === newMarker){
marker.setMap(null);
Array.remove(myMarkers["userComment"], i);
updateMarkerList();
}
});
});
if(typeof myMarkers["userComment"] == "undefined"){
myMarkers["userComment"] = [];
}
myMarkers["userComment"].push(newMarker);
updateMarkerList();
}
//update marker list
//{{{
function updateMarkerList(){
$("#commentMarkerList").empty();
var path = [];
if(myMarkers["userComment"].length == 0){
$("#commentAccord .step").hide();
}
else{
$("#commentAccord .step").show();
}
$(myMarkers["userComment"]).each(function(i, marker){
path.push(marker.getPosition());
var listItem = $("<li></li>").addClass("ui-state-default").attr("id", i);
$(listItem).mouseenter(function(){
marker.setShadow("img/highlightmarker.png");
});
$(listItem).mouseleave(function(){
marker.setShadow("");
});
var titleLink = $("<a></a>").attr({
innerHTML : "Point",
href : "javascript:void(0);"
});
var removeLink = $("<a></a>").attr({
innerHTML : "(remove this)",
href : "javascript:void(0);"
});
$(removeLink).click(function(){
marker.setMap(null);
Array.remove(myMarkers["userComment"], i);
updateMarkerList();
});
$(listItem).append(
$("<span></span>").addClass("ui-icon ui-icon-arrowthick-2-n-s")
);
$(listItem).append(titleLink).append(removeLink);
$("#commentMarkerList").append(listItem);
});
if(typeof userCommentPolyline != "undefined"){
userCommentPolyline.setMap(null);
}
var polylineopts = {
path : path,
strokeColor : "#FF0000",
strokeWeight : 5,
strokeOpacity : 1
};
userCommentPolyline = new google.maps.Polyline(polylineopts);
userCommentPolyline.setMap(map);
$("#commentMarkerList").sortable({
placeholder: 'ui-state-highlight',
stop : function(evt, ui){
var newList = [];
$("#commentMarkerList li").each(function(i,listitem){
newList.push(myMarkers["userComment"][parseInt($(listitem).attr("id"))]);
});
myMarkers["userComment"] = newList;
updateMarkerList();
}
});
$("#commentMarkerList").disableSelection();
}
//}}}
//clear User comments
//{{{
function clearUserComments(type){
if(typeof myMarkers[type] !== "undefined"){
$(myMarkers[type]).each(function(i,marker){
marker.setMap(null);
});
myMarkers[type]=[];
if(type == "userComment"){
updateMarkerList();
}
}
}
//}}}
//create comments
//{{{
function createComments(){
$.getJSON('data.aspx',
{"p":"commentdata","d":new Date().getTime()},
function(data){
//console.log(data);
$(data).each(function(i,comment){
//console.log(commentTypes[comment.cat_id-1]);
if(typeof commentTypes[comment.cat_id-1] !== "undefined") {
if(typeof commentTypes[comment.cat_id-1].comments == "undefined"){
commentTypes[comment.cat_id-1]["comments"] = [];
}
//create path and anchor from comment.positions
//{{{
var path = [];
var anchor;
$(comment.positions).each(function(i, position){
var pos = new google.maps.LatLng(
position.lat,
position.lng
);
if(position.anchor){
anchor = pos;
}
path.push(pos);
});
//}}}
var isLine = (path.length > 1);
//marker and poly line creation
//{{{
var iconToShow = (isLine)?
commentTypes[comment.cat_id-1].markerLineImage
: commentTypes[comment.cat_id-1].markerImage;
var marker = new google.maps.Marker({
//map : map,
title : commentTypes[comment.cat_id-1].title,
position : anchor,
icon : iconToShow
});
var polyline = new google.maps.Polyline({
path : path,
strokeColor : "#106999",
strokeWeight : 5,
map : null,
strokeOpacity : 1
});
//}}}
//link bar in infowindow creation
//{{{
var zoomLink = $("<a></a>").attr({
href : "javascript:zoomTo("+anchor.lat()+","+anchor.lng()+",16);javascript:void(0);",
innerHTML : "Zoom here"
}).addClass("infowinlink");
var likeLink = $("<a></a>").attr({
href : "javascript:markerVote("+comment.id+",true);void(0);",
innerHTML : "Like"
}).addClass("infowinlink likelink");
var dislikeLink = $("<a></a>").attr({
href : "javascript:markerVote("+comment.id+",false);void(0);",
innerHTML : "Dislike"
}).addClass("infowinlink dislikelink");
var linkBar = $("<div></div>").addClass('linkbar').append(zoomLink).append(" | ")
.append(likeLink).append(" | ")
.append(dislikeLink);
if(isLine){
var showLineLink = $("<a></a>").attr({
href : "javascript:myMarkers["+comment.id+"].line.setMap(map);$('.toggleLineLink').toggle();void(0);",
innerHTML : "Show line",
id : "infowin-showline"
}).addClass("infowinlink toggleLineLink");
var hideLineLink = $("<a></a>").attr({
href : "javascript:myMarkers["+comment.id+"].line.setMap(null);$('.toggleLineLink').toggle();void(0);",
innerHTML : "Hide line",
id : "infowin-hideline"
}).addClass("infowinlink toggleLineLink");
$(linkBar).append(" | ").append(showLineLink).append(hideLineLink);
}
//}}}
//var content = "<div class='infowin'><h4>"+commentTypes[comment.cat_id-1].title +"</h4><p>"+comment.text+"</p>";
var content = "<div class='infowin'><h4>"+comment.name +"</h4><p>"+comment.text+"</p>";
content += $(linkBar).attr("innerHTML")+"</div>";
//marker click function
//{{{
google.maps.event.addListener(marker, 'click', function(){
infoWin.setContent(content);
infoWin.open(map, marker);
currMarkerDom(comment.id);
});
//}}}
var obj = {"marker": marker, "line":polyline};
commentTypes[comment.cat_id-1].comments.push(obj);
myMarkers[comment.id]=obj;
////myMarkers.all = $.map(myMarkers, function (n,i) { return n; });
//myMarkers.all.push(marker);
markerArray.push(marker);
}});
var isLoad = false;
google.maps.event.addListener(map,'tilesloaded', function () {
if (!isLoad) {
isLoad = true;
mc = new MarkerClusterer(map, markerArray, {maxZoom:16});
}
});
}
);
}
//}}}