Esempio Online Anteprima
Sorgente PHP: examples/maps/simple-map.php
Sorgente XML: examples/maps/simple-map.xml
L'esempio mostra come visualizzare una mappa centrata su Roma ed associare all'evento onclik la restituzione delle coordinate del punto stesso.
<?php
/**
* PHP Source File
* @author Alyx Association <info@alyx.it>
* @version 1.0
* @copyright Alyx Association 2008-2010
* @license GNU Public License
*/
require_once("./../../class/system.class.php");
$system = new ClsSystem(true);
$xml = new ClsXML("simple-map.xml");
$event = new ClsEvent($xml);
$event->managerRequest();
function html_load()
{
global $event;
$code="
JMAP.after_drawmap =
function()
{
GEvent.addListener(JMAP.Map, 'click', function(overlay, point)
{
if (!overlay) JMAP.Map.openInfoWindow(point, 'Lat=' + point.y + ', Lng=' + point.x);
});
}
";
$event->setCodeJs($code);
}
?>
<?xml version="1.0" encoding="utf-8"?>
<jamp>
<page typeobj="page" title="JAMP - Esempio google maps, mappa semplice" icon="../../favicon.ico" loaddata="true">
<label typeobj="label" label="Clicca sulla mappa per visualizzare le coordinate\n" />
<map typeobj="map" style="width: 70%; height: 480px; float:left; border: 1px solid black;" address="Roma" />
</page>
</jamp>