[mapguide-users] mapguide react.js embeded in div or iframe issue

Rémy Gourrat rgourrat at ag-carto.fr
Mon Feb 20 09:31:41 PST 2017


Hi thanks for your answered,

My goal is to have a simple mapguide window (iframe) in my specific data collector application (my application is on top document) and just click button to get the x,y of the digitized point in the mapguide viewer.

i geted a solution with a mapguide iframe, I can digitize and get point x,y, it's works fine.

Curiously, the error message at loading about MapInit, for my moment usage seems not to be a problem for DigitizePoint..

My html page with mapguide in an iframe, if you want test : 

consol.log return :

VM170 pageLoadFunctions.js:25 Uncaught TypeError: Cannot read property 'mapInit' of undefined
    at window.onload (VM170 pageLoadFunctions.js:25)
window.onload @ VM170 pageLoadFunctions.js:25


<!DOCTYPE html>
<html>
<head>
	<script>
		function digitize_point_from_iframe()
		{
			document.getElementById("mapguide_iframe_react").contentWindow.GetMapFrame().DigitizePoint(OnPointDigitized);
		}

		function OnPointDigitized(point) 
		{
          document.getElementById("ag_x").value = point.X;
          document.getElementById("ag_y").value = point.Y;		  
		}	
	</script>
</head>
<body>
		<input id="ag_x" type="text">
		<input id="ag_y" type="text">
		<input id="ag_digit_point" type="button" onclick="digitize_point_from_iframe('mapguide_iframe_ajax');">
		<BR>

		<iframe id="mapguide_iframe_react" src="../mapguide/viewer/index.html?resource=Library://Samples/Sheboygan/Layouts/SheboyganAsp.WebLayout" width="1000" height="800">
		</iframe>
</body>

Thanks for your help.

Rémy


More information about the mapguide-users mailing list