Ticket #19165: 19165.2.patch

File 19165.2.patch, 1.2 KB (added by GerdP, 5 years ago)

OK, found out that OsmWriter is also used to write changesets, so it must write deleted objects. We must not write a deleted object to pbf because the status deleted is lost. So, isUsable() should be the right choice for pbf.

  • src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java

     
    485485        public void process(DataSet ds) {
    486486            processor.processSources(ds.getDataSources());
    487487            Comparator<OsmPrimitive> cmp = Comparator.comparingLong(OsmPrimitive::getUniqueId);
    488             ds.getNodes().stream().sorted(cmp).filter(n -> n.isLatLonKnown()).forEach(processor::processNode);
    489             ds.getWays().stream().sorted(cmp).filter(w -> w.getNodesCount() > 0).forEach(processor::processWay);
    490             ds.getRelations().stream().sorted(cmp).filter(r -> r.getMembersCount() > 0).forEach(processor::processRelation);
     488            ds.getNodes().stream().sorted(cmp).filter(Node::isUsable).forEach(processor::processNode);
     489            ds.getWays().stream().sorted(cmp).filter(Way::isUsable).forEach(processor::processWay);
     490            ds.getRelations().stream().sorted(cmp).filter(Relation::isUsable).forEach(processor::processRelation);
    491491        }
    492492
    493493        public void complete() {