Hi,
Can someone please tell me how to hide/show a base overlay (OSM) via client-side, which is triggered by a checkbox?
I can’t find any from the client API: download.thinkgeo.com/docs/mvc/clientapi/
Thanks,
Benito
Toggle BaseLayer Show/Hide
Hi Benito,
Please try the below codes:
function toggleLayer(layerId) {
var layer = Map1.getLayer(layerId);
if (layer) {
if (layer.visibility) {
layer.visibility = false;
}
else {
layer.visibility = true;
// setting it to the base layer is optional.
Map1.setBaseLayer(layer);
}
}
}
Please let us know if there is any questions.
Thanks,
Johnny
Hi Johnny,
This works like a charm. Thank you very much!
Regards,
Benito
Hi Benito,
Good to hear it works.
If any other questions or queries, please feel free to let us know.
Best regards,
Johnny