]> git.openstreetmap.org Git - nominatim.git/blob - lib-php/website/deletable.php
Merge pull request #3373 from lonvia/restrict-man-made
[nominatim.git] / lib-php / website / deletable.php
1 <?php
2 /**
3  * SPDX-License-Identifier: GPL-2.0-only
4  *
5  * This file is part of Nominatim. (https://nominatim.org)
6  *
7  * Copyright (C) 2022 by the Nominatim developer community.
8  * For a full list of authors see the git log.
9  */
10
11 require_once(CONST_LibDir.'/init-website.php');
12 require_once(CONST_LibDir.'/log.php');
13 require_once(CONST_LibDir.'/output.php');
14 ini_set('memory_limit', '200M');
15
16 $oParams = new Nominatim\ParameterParser();
17 $sOutputFormat = $oParams->getSet('format', array('json'), 'json');
18 set_exception_handler_by_format($sOutputFormat);
19
20 $oDB = new Nominatim\DB(CONST_Database_DSN);
21 $oDB->connect();
22
23 $sSQL = 'select placex.place_id, country_code,';
24 $sSQL .= " name->'name' as name, i.* from placex, import_polygon_delete i";
25 $sSQL .= ' where placex.osm_id = i.osm_id and placex.osm_type = i.osm_type';
26 $sSQL .= ' and placex.class = i.class and placex.type = i.type';
27 $aPolygons = $oDB->getAll($sSQL, null, 'Could not get list of deleted OSM elements.');
28
29 if (CONST_Debug) {
30     var_dump($aPolygons);
31     exit;
32 }
33
34 if ($sOutputFormat == 'json') {
35     javascript_renderData($aPolygons);
36 }