Skip to main content
use inline code span format for code within text
Source Link

If you want to use checkboxes to toggle polygons, you can set a user-defined properties when you creating a new polygon. For example:

var polygon = new google.maps.Polygon({
        paths: data.location,
        fillColor: '#6c757d',
        fillOpacity: 0.4,
        strokeWeight: 0,
        strokeOpacity: 0,
        clickable: true,
        markers: [],
        treeMap: new Map(),
        name: data.name,
        manager: data.manager,
        id: data.id,
        density_color: '#6c757d'
    });

The last 6 properties are user-defined so that you can add ID property for each polygon and toggle them using setMap(Null)setMap(Null). Ps

Ps: You should put all your polygons in an array for better manipulating.

If you want to use checkboxes to toggle polygons, you can set a user-defined properties when you creating a new polygon. For example:

var polygon = new google.maps.Polygon({
        paths: data.location,
        fillColor: '#6c757d',
        fillOpacity: 0.4,
        strokeWeight: 0,
        strokeOpacity: 0,
        clickable: true,
        markers: [],
        treeMap: new Map(),
        name: data.name,
        manager: data.manager,
        id: data.id,
        density_color: '#6c757d'
    });

The last 6 properties are user-defined so that you can add ID property for each polygon and toggle them using setMap(Null). Ps: You should put all your polygons in an array for better manipulating.

If you want to use checkboxes to toggle polygons, you can set a user-defined properties when you creating a new polygon. For example:

var polygon = new google.maps.Polygon({
        paths: data.location,
        fillColor: '#6c757d',
        fillOpacity: 0.4,
        strokeWeight: 0,
        strokeOpacity: 0,
        clickable: true,
        markers: [],
        treeMap: new Map(),
        name: data.name,
        manager: data.manager,
        id: data.id,
        density_color: '#6c757d'
    });

The last 6 properties are user-defined so that you can add ID property for each polygon and toggle them using setMap(Null).

Ps: You should put all your polygons in an array for better manipulating.

Source Link

If you want to use checkboxes to toggle polygons, you can set a user-defined properties when you creating a new polygon. For example:

var polygon = new google.maps.Polygon({
        paths: data.location,
        fillColor: '#6c757d',
        fillOpacity: 0.4,
        strokeWeight: 0,
        strokeOpacity: 0,
        clickable: true,
        markers: [],
        treeMap: new Map(),
        name: data.name,
        manager: data.manager,
        id: data.id,
        density_color: '#6c757d'
    });

The last 6 properties are user-defined so that you can add ID property for each polygon and toggle them using setMap(Null). Ps: You should put all your polygons in an array for better manipulating.