'How to change the map (Mapbox) properties with JavaScript?
I have a tableau dashboard that contains a map from Mapbox, the dashboard:
<div class='tableauPlaceholder' id='viz1647788729439' style='position: relative'>
<noscript>
<a href='#'>
<img alt='Dashboard 2 ' src='https://public.tableau.com/static/images/YQ/YQD7J4J2T/1_rss.png'
style='border: none' />
</a>
</noscript>
<object class='tableauViz' style='display:none;'><param name='host_url' value='https%3A%2F%2Fpublic.tableau.com%2F' />
<param name='embed_code_version' value='3' /> <param name='path' value='shared/YQD7J4J2T' /> <param name='toolbar' value='yes' />
<param name='static_image' value='https://public.tableau.com/static/images/YQ/YQD7J4J2T/1.png' />
<param name='animate_transition' value='yes' /><param name='display_static_image' value='yes' />
<param name='display_spinner' value='yes' /><param name='display_overlay' value='yes' />
<param name='display_count' value='yes' />
<param name='language' value='en-GB' />
<param name='filter' value='publish=yes' />
</object>
</div>
<script type='text/javascript'>
var divElement = document.getElementById('viz1647788729439');
var vizElement = divElement.getElementsByTagName('object')[0];
if (divElement.offsetWidth > 800) {
vizElement.style.width = '1000px';
vizElement.style.height = '827px';
} else if (divElement.offsetWidth > 500) {
vizElement.style.width = '1000px';
vizElement.style.height = '827px';
} else {
vizElement.style.width = '100%';
vizElement.style.height = '1477px';
}
var scriptElement = document.createElement('script');
scriptElement.src = 'https://public.tableau.com/javascripts/api/viz_v1.js';
vizElement.parentNode.insertBefore(scriptElement, vizElement);
</script>
So I want to center the map to Sudan cords lat:12.8628, lng: 30.2176, and zoom to country level then add a polygon of the country's stats Sudan stats polygon then disable the map dragging event so its only shows Sudan
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
