forked from twbell/GPLplanet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disambiguate.php
33 lines (29 loc) · 875 Bytes
/
disambiguate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* Web Service Wrapper for Placename disambiguation (demonstration)
* Add placename to 'q'parameters (default format is json; use 'format=serialize for php); use 'focus' parameter to bias results
* @example http://example.com/gplplanet/webservice/disambiguate.php?q="soma, san francisco"
* @package gplplanet
* @author Tyler Bell tylerwbell[at]gmail[dot]com
* @copyright (C) 2009,2010 - Tyler Bell
*/
error_reporting(0);
require_once ('../class.geoengine.php');
$engine = geoengine :: getInstance();
$res = array ();
if ($_REQUEST['q']) {
if ($_REQUEST['focus']) {
$res = $engine->disambiguate($_REQUEST['q'], $_REQUEST['focus']);
} else {
$res = $engine->disambiguate($_REQUEST['q']);
}
}
//Format, return
if ($_REQUEST['format'] == "serialized") {
$res = serialize($res);
print_r($res);
} else {
$res = json_encode($res);
print_r($res);
}
?>