All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openstreetmap.atlas.utilities.testing.OsmFileToPbf Maven / Gradle / Ivy

There is a newer version: 7.0.8
Show newest version
package org.openstreetmap.atlas.utilities.testing;

import org.openstreetmap.atlas.streaming.resource.Resource;
import org.openstreetmap.atlas.streaming.resource.WritableResource;
import org.openstreetmap.osmosis.osmbinary.file.BlockOutputStream;
import org.openstreetmap.osmosis.xml.common.CompressionMethod;

import crosby.binary.osmosis.OsmosisSerializer;

/**
 * @author matthieun
 */
public class OsmFileToPbf
{
    public void update(final Resource osmFile, final WritableResource pbfFile)
    {
        final OsmosisXmlReaderFromResource osmReader = new OsmosisXmlReaderFromResource(osmFile,
                true, CompressionMethod.None);
        final OsmosisSerializer pbfWriter = new OsmosisSerializer(
                new BlockOutputStream(pbfFile.write()));
        osmReader.setSink(pbfWriter);
        osmReader.run();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy