-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathTDSv71.js
84 lines (71 loc) · 2.37 KB
/
TDSv71.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* This file is part of Hootenanny.
*
* Hootenanny is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --------------------------------------------------------------------
*
* The following copyright notices are generated automatically. If you
* have a new notice to add, please use the format:
* " * @copyright Copyright ..."
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
* @copyright Copyright (C) 2018 DigitalGlobe (http://www.digitalglobe.com/)
*/
//
// Convert TDSv70 to/from OSM+
//
// include HootJs if loaded from mocha test
if (typeof hoot === 'undefined') {
var hoot = require(process.env.HOOT_HOME + '/lib/HootJs');
}
hoot.require('SchemaTools');
hoot.require('tds71');
hoot.require('tds71_schema');
hoot.require('tds71_rules');
hoot.require('translate');
hoot.require('fcode_common');
function initialize()
{
// Set the schema type for the export
hoot.Settings.set({'map.writer.schema':'TDSv71'});
}
// Layer name filter - Filter out all layers that match this regexp
function layerNameFilter()
{
// Drop all of the "SRC_*", "o2s_*" and "extra_*" layers
return '^(?!SRC_|extra_)';
}
// Create the output Schema
function getDbSchema()
{
return tds71.getDbSchema();
}
// IMPORT
// translateToOsm - takes 'attrs' and returns OSM 'tags'
function translateToOsm(attrs, layerName, geometryType)
{
return tds71.toOsm(attrs, layerName, geometryType);
} // End of translateToOsm
// EXPORT
// translateToOgr - takes 'tags' + geometry and returns 'attrs' + tableName
function translateToOgr(tags, elementType, geometryType)
{
return tds71.toOgr(tags, elementType, geometryType);
} // End of translateToOgr
// module method for use in Translation Server
if (typeof exports !== 'undefined') {
exports.toOsm = tds71.toOsm;
}