Skip to content

Commit 26e93e0

Browse files
authored
hack to add source (hootapidb) property to alpha clipped task grid export (#3584)
* removing option that has no effect on conflate * removing same commented out option * hack to add source (hootapidb) property to alpha clipped task grid export refs #3583 * update test expectations
1 parent 6f19a2c commit 26e93e0

File tree

5 files changed

+66
-14
lines changed

5 files changed

+66
-14
lines changed

hoot-services/src/main/java/hoot/services/controllers/conflation/ConflateCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public static boolean isUiOption(String key) {
117117
this.conflateParams = params;
118118

119119
List<String> options = new LinkedList<>();
120-
options.add("convert.ops=hoot::DecomposeBuildingRelationsVisitor");
121120
options.add("writer.include.conflate.score.tags=false");
122121
options.add("hootapi.db.writer.overwrite.map=true");
123122
options.add("writer.text.status=true");

hoot-services/src/main/java/hoot/services/controllers/export/ExportResource.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,14 @@ public Response export(ExportParams params,
215215
params.setOutputType("alpha.shp");
216216
workflow.add(getCommand(user, jobId, params, debugLevel));
217217
params.setInputType("file");
218+
params.setTagOverrides(params.getInput());
218219
params.setInput(workDir.getAbsolutePath() + "/" + params.getOutputName());
219220
Command ogrClipCommand = new OgrClipCommand(jobId, params, this.getClass());
220221
workflow.add(ogrClipCommand);
221222
Command ogrFormatCommand = new OgrFormatCommand(jobId, params, this.getClass());
222223
workflow.add(ogrFormatCommand);
224+
Command sedSourceCommand = new SedSourceCommand(jobId, params, this.getClass());
225+
workflow.add(sedSourceCommand);
223226
Command zipCommand = new ZIPFileCommand(new File(workDir, params.getOutputName() + ".zip"), workDir, outputName + ".alpha.tiles.geojson", this.getClass());
224227
workflow.add(zipCommand);
225228

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* This file is part of Hootenanny.
3+
*
4+
* Hootenanny is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*
17+
* --------------------------------------------------------------------
18+
*
19+
* The following copyright notices are generated automatically. If you
20+
* have a new notice to add, please use the format:
21+
* " * @copyright Copyright ..."
22+
* This will properly maintain the copyright information. DigitalGlobe
23+
* copyrights will be updated automatically.
24+
*
25+
* @copyright Copyright (C) 2019 DigitalGlobe (http://www.digitalglobe.com/)
26+
*/
27+
package hoot.services.controllers.export;
28+
29+
import java.io.File;
30+
import java.util.HashMap;
31+
import java.util.Map;
32+
33+
import hoot.services.command.ExternalCommand;
34+
35+
36+
class SedSourceCommand extends ExternalCommand {
37+
38+
SedSourceCommand(String jobId, ExportParams params, Class<?> caller) {
39+
super(jobId);
40+
41+
Map<String, Object> substitutionMap = new HashMap<>();
42+
substitutionMap.put("INPUT", params.getInput());
43+
substitutionMap.put("REGEX", "s/\"type\": \"FeatureCollection\",/\"type\": \"FeatureCollection\",\"source\": \"hootapidb:" + params.getTagOverrides() + "\",/");
44+
45+
46+
//Hack to add source property into geojson output
47+
//the shapefile output needed for ogr2ogr clipsrc can't store a source property on hoot export
48+
String command = "sed -i ${REGEX} ${INPUT}.alpha.tiles.geojson";
49+
50+
super.configureCommand(command, substitutionMap, caller, new File("/tmp"));
51+
}
52+
}

hoot-services/src/main/java/hoot/services/controllers/ingest/ImportCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ class ImportCommand extends ExternalCommand {
7878
List<String> inputs = filesToImport.stream().map(File::getAbsolutePath).collect(Collectors.toList());
7979

8080
List<String> options = new LinkedList<>();
81-
//options.add("convert.ops=hoot::DecomposeBuildingRelationsVisitor");
8281
//TODO: always set remap ids to false??
8382
options.add("hootapi.db.writer.overwrite.map=true");
8483
options.add("job.id=" + jobId);

0 commit comments

Comments
 (0)