Unable to use latest mapPlugin for DHIS2 2.30+ API in a web portal

Dear All, I have been trying to integrate DHIS2 dashboards into a web portal using the latest map plugin. While this seem to work with mapPlugin of 2.29 (but has issues referencing i18n properties file), the mapPlugin in the newer DHIS2 version does not seem to work. The error is related to a 401 Unauthorized Access error as seen below

A section of my mapPlugin used is below

        var dhis2 = <?php echo $details; ?>;
        var mp_objects = <?php echo $map_elements; ?>;
        mapPlugin.url = dhis2.dhis2_uri;
        mapPlugin.username = dhis2.dhis2_username;
        mapPlugin.password = dhis2.dhis2_password;
        mapPlugin.loadingIndicator = true;

But I get the get the error below:

And also it is complaining of mapJavascriptAPI


Hi Stephen,

You can download the map plugin from your DHIS2 instance like:

This is an example using the 2.32.3 map plugin:

    <script src="map-2.32.3.js"></script>
    <div id="map" style="width:800px;height:514px;"></div>
      mapPlugin.url = '//localhost:8080';

        el: "map",
        id: "iKgbemGaDUh"

Hi Bjorn, Thanks for the script. I have tested the scripts already and receiving the 401 errors. The map.js that works is for the DHIS2 2.29 but only supports also 2.29.

for the purpose of other people who may be interested in integrating maps on their external system, is it possible to get all applicable options available with the mapPlugin?


I’ve created an issue, and is working on a fix that will be backported to 2.30: [DHIS2-8215] - Jira

Fixed and backported to 2.30. It might take some time before the plugin is available in the public builds.

Hi @Bjorn_Sandvik,
Please Possible to have example of using dynamic variable (Custom object) both boundarie layer and thematic layer than using favorite id?
The current documentation does not provide example of mapPlugin.load use.