How to remove one polyline of several with jquery.ui.map?

105 views Asked by At

I have two polylines on the map:

  1. Polyline 1 as route
  2. Polyline 2 as other

I want to clear only one. How can I do that?

I have tried with:

$('#map_canvas').gmap('clear', 'overlays > Polyline').route

But it does not work.

$('#map_canvas').gmap('addShape', 
                'Polyline', {
                 tags:'other',
          property: 'tags',
     path: other_positions,
   strokeColor: '#ff0000',
   strokeOpacity: 1.0,
   strokeWeight: 2
  });
 
$('#map_canvas').gmap('addShape', 
                'Polyline', {
   tags:'route',
          property: 'tags',
   path: array_positions,
   strokeColor: '#0000ff',
   strokeOpacity: 1.0,
   strokeWeight: 2
  });



When clicking a button, I want only this polyline (route) to be cleared while it clears both

1

There are 1 answers

0
Captain Red On

I suppose you just have the code portion that has the path =>array_positions

$('#map_canvas').gmap('addShape', 'Polyline', { tags:'route', 
property: 'tags', path: array_positions, 
strokeColor: '#0000ff', strokeOpacity: 1.0, strokeWeight: 2 }); 

Getting rid of the Poly line that displays the other positions.