当前位置: 首页>>代码示例>>Java>>正文


Java Osmformat.HeaderBlock方法代码示例

本文整理汇总了Java中org.openstreetmap.osmosis.osmbinary.Osmformat.HeaderBlock方法的典型用法代码示例。如果您正苦于以下问题:Java Osmformat.HeaderBlock方法的具体用法?Java Osmformat.HeaderBlock怎么用?Java Osmformat.HeaderBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openstreetmap.osmosis.osmbinary.Osmformat的用法示例。


在下文中一共展示了Osmformat.HeaderBlock方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
public void parse(Osmformat.HeaderBlock block) {
	for (String s : block.getRequiredFeaturesList()) {
		if (s.equals("OsmSchema-V0.6")) {
			continue;
		}
		if (s.equals("DenseNodes")) {
			continue;
		}
		if (s.equals("HistoricalInformation")) {
			continue;
		}
		log.error("Cannot parse file");
		System.exit(0);
	}
}
 
开发者ID:SGroe,项目名称:vgi-analytics-framework,代码行数:17,代码来源:OsmPbfParser.java

示例2: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
public void parse(Osmformat.HeaderBlock block) {
    for (String s : block.getRequiredFeaturesList()) {
        if (s.equals("OsmSchema-V0.6")) {
            continue; // We can parse this.
        }
        if (s.equals("DenseNodes")) {
            continue; // We can parse this.
        }
        throw new IllegalStateException("File requires unknown feature: " + s);
    }
    if (block.hasOsmosisReplicationTimestamp()) {
        long timestamp = block.getOsmosisReplicationTimestamp();
        LOG.info("PBF file has a replication timestamp of {}", Instant.ofEpochSecond(timestamp));
        entitySink.setReplicationTimestamp(timestamp);
    } else {
        LOG.info("PBF file has no replication timestamp.");
    }
}
 
开发者ID:conveyal,项目名称:osm-lib,代码行数:20,代码来源:PBFInput.java

示例3: writeOneBlob

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
/** @param block is either a PrimitiveBlock or a HeaderBlock */
private void writeOneBlob(GeneratedMessageLite block) {

    // FIXME lotsa big copies going on here

    String blobTypeString;
    if (block instanceof Osmformat.HeaderBlock) {
        blobTypeString = "OSMHeader";
    } else if (block instanceof Osmformat.PrimitiveBlock) {
        blobTypeString = "OSMData";
    } else {
        throw new AssertionError("block must be either a header block or a primitive block.");
    }

    Fileformat.Blob.Builder blobBuilder = Fileformat.Blob.newBuilder();
    byte[] serializedBlock = block.toByteArray();
    byte[] deflatedBlock = new byte[serializedBlock.length];
    int deflatedSize = deflate(serializedBlock, deflatedBlock);
    if (deflatedSize < 0) {
        LOG.debug("Deflate did not reduce the size of a block. Saving it uncompressed.");
        blobBuilder.setRaw(ByteString.copyFrom(serializedBlock));
    } else {
        blobBuilder.setZlibData(ByteString.copyFrom(deflatedBlock, 0, deflatedSize));
        blobBuilder.setRawSize(serializedBlock.length);
    }
    byte[] serializedBlob = blobBuilder.build().toByteArray();

    Fileformat.BlobHeader blobHeader = Fileformat.BlobHeader.newBuilder()
            .setType(blobTypeString).setDatasize(serializedBlob.length).build();
    byte[] serializedBlobHeader = blobHeader.toByteArray();
    try {
        // "Returns a big-endian representation of value in a 4-element byte array"
        downstream.write(Ints.toByteArray(serializedBlobHeader.length));
        downstream.write(serializedBlobHeader);
        downstream.write(serializedBlob);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

}
 
开发者ID:conveyal,项目名称:osm-lib,代码行数:41,代码来源:PBFOutput.java

示例4: processOsmHeader

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
private void processOsmHeader( byte[] data ) throws InvalidProtocolBufferException
{
    Osmformat.HeaderBlock header = Osmformat.HeaderBlock.parseFrom(data);

    // Build the list of active and unsupported features in the file.
    List<String> supportedFeatures = Arrays.asList("OsmSchema-V0.6", "DenseNodes");
    List<String> activeFeatures = new ArrayList<String>();
    List<String> unsupportedFeatures = new ArrayList<String>();
    for (String feature : header.getRequiredFeaturesList())
    {
        if (supportedFeatures.contains(feature))
        {
            activeFeatures.add(feature);
        } else
        {
            unsupportedFeatures.add(feature);
        }
    }

    // We can't continue if there are any unsupported features. We wait
    // until now so that we can display all unsupported features instead of
    // just the first one we encounter.
    if (unsupportedFeatures.size() > 0)
    {
        throw new RuntimeException("PBF file contains unsupported features " + unsupportedFeatures);
    }

}
 
开发者ID:abrensch,项目名称:brouter,代码行数:29,代码来源:BPbfBlobDecoder.java

示例5: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
public void parse(Osmformat.HeaderBlock block) {
	for (String s : block.getRequiredFeaturesList()) {
		if (s.equals("OsmSchema-V0.6")) {
			continue; // We can parse this.
		}
		if (s.equals("DenseNodes")) {
			continue; // We can parse this.
		}
		throw new RuntimeException("File requires unknown feature: " + s);
	}

	//        if (block.hasBbox()) {
	//            String source = OsmosisConstants.VERSION;
	//            if (block.hasSource()) {
	//                source = block.getSource();
	//            }
	//
	//            double multiplier = .000000001;
	//            double rightf = block.getBbox().getRight() * multiplier;
	//            double leftf = block.getBbox().getLeft() * multiplier;
	//            double topf = block.getBbox().getTop() * multiplier;
	//            double bottomf = block.getBbox().getBottom() * multiplier;
	//
	//            Bound bounds = new Bound(rightf, leftf, topf, bottomf, source);
	//            sink.process(new BoundContainer(bounds));
	//        }
}
 
开发者ID:opensciencemap,项目名称:vtm,代码行数:29,代码来源:OsmPbfParser.java

示例6: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
protected void parse(Osmformat.HeaderBlock headerBlock) {
}
 
开发者ID:AReallyGoodName,项目名称:OfflineReverseGeocodeOSM,代码行数:4,代码来源:OSMReader.java

示例7: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
protected void parse(
		Osmformat.HeaderBlock header ) {

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:6,代码来源:OsmPbfParser.java

示例8: parse

import org.openstreetmap.osmosis.osmbinary.Osmformat; //导入方法依赖的package包/类
@Override
protected void parse(Osmformat.HeaderBlock header) {

}
 
开发者ID:ngageoint,项目名称:geowave-osm,代码行数:5,代码来源:OsmPbfParser.java


注:本文中的org.openstreetmap.osmosis.osmbinary.Osmformat.HeaderBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。