Embedding GIS maps in JavaScript / HTML

Hello,

How we embed maps from 2.30 version? GIS old way is outdating and not working anymore and for the new Maps app there’s no any documentation.

Those functions don’t work anymore:
GIS.plugin.getMap({
DHIS.getMap({

at least ext-all.js is referencing some dependencies wrongly but I don’t know if this is related.

Any info on this ?

Thanks !

1 Like

Hi!

I managed finally to make maps work in HTML using the GIS plugin.

What I needed was:

<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.util.js"></script>
<script type="text/javascript" src="../../../dhis-web-mapping/extjs/ext-all.js"></script>
<script type="text/javascript" src="../../../dhis-web-mapping/map.js"></script>

<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js"></script>
<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js"></script>
<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js"></script>
<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js"></script>
<script type="text/javascript" src="../../../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>

and the DHIS.getMap function …

	    var base = "../../..";
        ....
		Ext.onReady(	function (){

			DHIS.getMap({
				url: base,
				el: idHtmlElement,
				basemap: mapStyle,
				mapViews: [{
					columns: [{dimension: "dx", items: [{id: dimension, dimensionItemType: dimentionType}]}],
					rows: [{dimension: "ou", items: itemsOnRow}],
					filters: [{
							dimension: "pe",
							items: [{id: year}]}],
					valueType: "in",
					layer: thematic,
 					legendSet: {id: "ABC0123456789"},
					labels: true, 
					opacity:opacityLevel/100
				}],
				onReady: function() {
                    console.log('map '+index +'is ready!');
                    ....
                }
			});
		});
1 Like

Could you please validate that and add it to the documentation ?

1 Like