-2

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

Unheilig
  • 16,196
  • 193
  • 68
  • 98
moi
  • 45
  • 1
  • 4

1 Answers1

0

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.

Captain Red
  • 1,171
  • 2
  • 16
  • 27