void individualManipulationsTest()
  {
    OsmReader reader;

    shared_ptr<OsmMap> map(new OsmMap());
    OsmMap::resetCounters();
    reader.read("test-files/manipulators/WayMergeManipulation.osm", map);

    MapReprojector::reprojectToOrthographic(map);

    long left = map->findWays("note", "3")[0];
    long right = map->findWays("note", "4")[0];

    map->getWay(left)->setStatus(Status::Unknown1);
    map->getWay(right)->setStatus(Status::Unknown2);

    WayMergeManipulation uut(left, right, map, 10.0);
    set<ElementId> ignored1, ignored2;
    shared_ptr<OsmMap> after(new OsmMap(map));
    uut.applyManipulation(after, ignored1, ignored2);

    MapReprojector::reprojectToWgs84(after);

    QDir().mkpath("test-output/manipulators/");

    OsmWriter writer;
    writer.setIncludeCompatibilityTags(false);
    writer.write(after, "test-output/manipulators/WayMergeManipulation.osm");

    HOOT_FILE_EQUALS("test-output/manipulators/WayMergeManipulation.osm",
                     "test-files/manipulators/WayMergeManipulationOutput.osm");
  }
    void funnyCurveTest()
    {
        OsmReader reader;

        OsmMap::resetCounters();

        shared_ptr<OsmMap> map(new OsmMap());
        reader.setDefaultStatus(Status::Unknown1);
        reader.read("test-files/MaximalNearestSubline2.osm", map);

        MapReprojector::reprojectToPlanar(map);

        long n1 = map->findWays("note", "1")[0];
        long n2 = map->findWays("note", "2")[0];
        shared_ptr<Way> left = MaximalNearestSubline::getMaximalNearestSubline(map,
                               map->getWay(n1),
                               map->getWay(n2),
                               10.0, 10.0);
        left->setStatus(Status::Conflated);
        left->setTag("name", "left");
        map->addWay(left);
        //cout << ElementConverter(map).convertToLineString(left)->toString() << endl;

        shared_ptr<Way> right = MaximalNearestSubline::getMaximalNearestSubline(map,
                                map->getWay(n2),
                                map->getWay(n1),
                                10.0, 10.0);
        right->setStatus(Status::Conflated);
        left->setTag("name", "right");
        map->addWay(right);
        //cout << ElementConverter(map).convertToLineString(right)->toString() << endl;

        shared_ptr<Way> w = WayAverager::average(map, right, left);
        w->setStatus(Status::Conflated);
        w->setTag("name", "average");
        map->addWay(w);
        //map->removeWay(n1);
        //map->removeWay(n2);
        QDir().mkpath("test-output/algorithms/");

        {
            shared_ptr<OsmMap> wgs84(new OsmMap(map));
            MapReprojector::reprojectToWgs84(wgs84);
            OsmWriter writer;
            writer.setIncludeCompatibilityTags(false);
            writer.setIncludeHootInfo(false);
            writer.setIncludeIds(false);
            QString fn = QString("test-output/algorithms/MaximalNearestSubline2TestOutput.osm");
            writer.write(wgs84, fn);
        }

        HOOT_FILE_EQUALS("test-files/algorithms/MaximalNearestSubline2TestOutput.osm",
                         "test-output/algorithms/MaximalNearestSubline2TestOutput.osm");
    }
  void runTest()
  {
    OsmReader reader;

    OsmMap::resetCounters();
    shared_ptr<OsmMap> map(new OsmMap());
    reader.setDefaultStatus(Status::Unknown1);
    reader.read("test-files/algorithms/LongestCommonNodeStringTest.osm", map);

    MapProjector::projectToOrthographic(map);
    DuplicateWayRemover::removeDuplicates(map);
    MapProjector::projectToWgs84(map);

    OsmWriter writer;
    writer.setIncludeCompatibilityTags(false);
    writer.write(map, "test-output/conflate/LongestCommonNodeStringTest.osm");

    HOOT_FILE_EQUALS("test-files/conflate/LongestCommonNodeStringTest.osm",
                     "test-output/conflate/LongestCommonNodeStringTest.osm");
  }
  /*
   * In this test we add in some non-matching, non-name text tags for two ways, and since strict
   * matching is *off*, we *should* see those two ways get merged.
   */
  void runStrictTagMatchingOffTest()
  {
    QDir().mkdir("test-output/conflate");
    OsmMap::resetCounters();
    shared_ptr<OsmMap> map(new OsmMap());
    OsmMapReaderFactory::read(map, "test-files/DcTigerRoads.osm", true, Status::Unknown1);

    //create a non matching text tag between two of the ways that will be examined
    map->getWay(map->findWays("name", "Constitution Ave NW")[0])->getTags().set("email", "blah");

    DuplicateWayRemover dupeWayRemover;
    dupeWayRemover.setStrictTagMatching(false);

    MapProjector::projectToOrthographic(map);
    dupeWayRemover.apply(map);
    MapProjector::projectToWgs84(map);

    OsmWriter writer;
    writer.setIncludeCompatibilityTags(false);
    writer.write(map, "test-output/conflate/DuplicateWayRemoverStrictTagMatchingOffTest.osm");

    HOOT_FILE_EQUALS("test-files/conflate/DuplicateWayRemoverStrictTagMatchingOffTest.osm",
                     "test-output/conflate/DuplicateWayRemoverStrictTagMatchingOffTest.osm");
  }