- This topic has 5 replies, 3 voices, and was last updated 10 years, 11 months ago by PaulLeBlanc.
-
AuthorPosts
-
YannMemberHello,
i need help to remove polylines on my map
i made a sqlite database with coordonates, i get this by this function:function viewtracing() { db.transaction(function (tx) { tx.executeSql('SELECT * FROM tracker', [], function (tx, results) { var len = results.rows.length, i; var str="" var point; var flightPlanCoordinates=new Array(); var map = $('[id$=map1]').gmap(); for (i = 0; i < len; i++){ //str += results.rows.item(i).latitude + ","+results.rows.item(i).longitude+"/"; point = new google.maps.LatLng( parseFloat(results.rows.item(i).latitude), parseFloat(results.rows.item(i).longitude)); flightPlanCoordinates[i]=point; } var flightPath = new google.maps.Polyline({ path: flightPlanCoordinates, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2 }); flightPath.setMap(map); }, null); }); }
i have also a button “Remove” who’s calling clear function
I tried this and many other things without successfunction clearroute() { var map = $('[id$=map1]').gmap(); var flightPath = new google.maps.Polyline({ path: [] }); flightPath.setMap(null); }
i’m not familiar with google map v3 api 🙁
if anyone can help me
thanks
Yann
BrandonMemberJust a though, but if you use the var inside I function I believe it is scoped to that function. So I think in your clear route you are creating a new flightpath, then clearing it instead of clearing an existing one. I could be wrong though.
YannMemberhello CincyPlanet
i tried to clear sql database and recall viewtracing() function without success
i don’t understand
thanks for your suggestion
Yann
YannMemberThanks again
with yours suggestions i found solution 🙂
i put my function inside viewtracing()clearroute=function () { if (flightPath){ flightPath.setMap(null); }
cool
BrandonMemberGlad you got it.
PaulLeBlancParticipantYann,
I knowit has been a long time, but could you post your code for “function viewtracing();{}”, so I can see exactly where you put “clearroute”I’m having porblems removing flightpath too. Thank you very much.
Paul -
AuthorPosts