void runConflateTest() { Settings testSettings = conf(); testSettings.set("conflate.enable.old.roads", "false"); OsmXmlReader reader; OsmMapPtr combinedMap(new OsmMap()); reader.setDefaultStatus(Status::Unknown1); reader.setUseDataSourceIds(true); reader.read( inputPath + "PertyMatchScorerTest-combined-out-1.osm", combinedMap); PertyMatchScorer matchScorer; matchScorer.setConfiguration(testSettings); matchScorer.setSearchDistance(15.0); matchScorer.setApplyRubberSheet(true); //matchScorer.setConfiguration(testSettings); /*boost::shared_ptr<MatchComparator> result =*/ matchScorer._conflateAndScoreMatches( combinedMap, outputPath + "PertyMatchScorerTest-conflated-out-1.osm"); //const double score = result->getPertyScore(); //MatchComparator test already covers testing the scoring, so not doing that here. HOOT_FILE_EQUALS( inputPath + "PertyMatchScorerTest-conflated-out-1.osm", outputPath + "PertyMatchScorerTest-conflated-out-1.osm"); }
shared_ptr<OsmMap> PertyMatchScorer::_combineMapsAndPrepareForConflation( shared_ptr<OsmMap> referenceMap, const QString perturbedMapInputPath) { LOG_DEBUG("Combining the reference and perturbed data into a single file ..."); // QFileInfo fileInfo(perturbedMapInputPath); // QString combinedOutputPath = fileInfo.path() + "/ref-after-combination.osm"; // LOG_DEBUG("saving a debug copy to " << combinedOutputPath << " ..."); shared_ptr<OsmMap> combinedMap(referenceMap); OsmUtils::loadMap(combinedMap, perturbedMapInputPath, false, Status::Unknown2); LOG_VARD(combinedMap->getNodeMap().size()); LOG_VARD(combinedMap->getWays().size()); if (Log::getInstance().getLevel() <= Log::Debug) { TagCountVisitor tagCountVisitor; combinedMap->visitRo(tagCountVisitor); const long numTotalTags = (long)tagCountVisitor.getStat(); LOG_VARD(numTotalTags); } // shared_ptr<OsmMap> combinedMapCopy(combinedMap); // MapProjector::reprojectToWgs84(combinedMapCopy); // OsmUtils::saveMap(combinedMapCopy, combinedOutputPath); // LOG_DEBUG("Preparing the reference data for conflation ..."); // QString combinedOutputPath2 = fileInfo.path() + "/ref-after-prep.osm"; // LOG_DEBUG("saving a debug copy to " << combinedOutputPath2 << " ..."); MatchScoringMapPreparer().prepMap(combinedMap, true); LOG_VARD(combinedMap->getNodeMap().size()); LOG_VARD(combinedMap->getWays().size()); if (Log::getInstance().getLevel() <= Log::Debug) { TagCountVisitor tagCountVisitor; combinedMap->visitRo(tagCountVisitor); const long numTotalTags = (long)tagCountVisitor.getStat(); LOG_VARD(numTotalTags); } // shared_ptr<OsmMap> combinedMapCopy2(combinedMap); // MapProjector::reprojectToWgs84(combinedMapCopy2); // OsmUtils::saveMap(combinedMapCopy2, combinedOutputPath2); if (_applyRubberSheet) { // LOG_DEBUG("Applying rubber sheet to pre-conflated data to move perturbed data towards " << // "reference data ..."); // QString combinedOutputPath3 = fileInfo.path() + "/ref-after-rubber-sheet.osm"; // LOG_DEBUG("saving a debug copy to " << combinedOutputPath3 << " ..."); //move Unknown2 toward Unknown1 conf().set(RubberSheet::refKey(), true); shared_ptr<RubberSheet> rubberSheetOp(new RubberSheet()); rubberSheetOp->apply(combinedMap); LOG_VARD(combinedMap->getNodeMap().size()); LOG_VARD(combinedMap->getWays().size()); if (Log::getInstance().getLevel() <= Log::Debug) { TagCountVisitor tagCountVisitor; combinedMap->visitRo(tagCountVisitor); const long numTotalTags = (long)tagCountVisitor.getStat(); LOG_VARD(numTotalTags); } // shared_ptr<OsmMap> combinedMapCopy3(combinedMapCopy2); // MapProjector::reprojectToWgs84(combinedMapCopy3); // OsmUtils::saveMap(combinedMapCopy3, combinedOutputPath3); } return combinedMap; }