|
|
|
|
|
Inserting a map on a web page

For the purpose of inserting and using amap on a website, it is necessary to have an EMAPI's key (which is available in Emapa’s Sales Department).

In the HEAD section of the web page, insert the following code:

<script src="http://emapi.pl/LoadApi.aspx?userId=xyz" type="text/javascript"></script>

The string "xyz" next to the parameter ?userId= has to be replaced with the previously received EMAPI's key.

In the BODY section DIV element into which the map will be embedded must be defined. Then assign the value of width, height and id. This can be determined by the style attribute in the page code or in an external style sheet.

The last step is to create a map using the EMAPI.Map function and loading it using parameter onload=init(); in BODY tag. The following code can be placed on the page in a SCRIPT tag or in an external script file.

init = function()
{
  var map = new EMAPI.Map('mapa1','userId');
}

where:
mapa1{String} The ID's element on the page, which will contain the map. (DIV tag).
userId{String} User ID (EMAPI’s key).


The sample code with embedded map and the effect of its implementation:

<HTML>
  <HEAD>
    ...
    <script src="http://emapi.pl/LoadApi.aspx?userId=xyz" type="text/javascript"></script> /*zewnętrzny skrypt javascript*/
    ...
    <style> //The parameters of DIV element   
    #mapa1 {
        border: 1px solid gray;
        width: 98%;
        height: 300px;
    }
    </style>
  </HEAD>
  <BODY onload=init();> //Induction the function init()
    <script type="text/javascript">
      init = function()
        {
          var map = new EMAPI.Map('mapa1','userID');
        }
    </script>
    <div id="mapa1"></div> // DIV element, where the map will be embedded
    ...
  </BODY>
</HTML>