private void processWays(List<Osmformat.Way> ways, PbfFieldDecoder fieldDecoder) { for (Osmformat.Way way : ways) { Map<String, String> tags = buildTags(way.getKeysList(), way.getValsList(), fieldDecoder); ReaderWay osmWay = new ReaderWay(way.getId()); osmWay.setTags(tags); // Build up the list of way nodes for the way. The node ids are // delta encoded meaning that each id is stored as a delta against // the previous one. long nodeId = 0; LongIndexedContainer wayNodes = osmWay.getNodes(); for (long nodeIdOffset : way.getRefsList()) { nodeId += nodeIdOffset; wayNodes.add(nodeId); } decodedEntities.add(osmWay); } }
@Override protected void parseWays(List<Osmformat.Way> ways) { try { for (Osmformat.Way w : ways) { if (wayCount++ % 1000000 == 0) { LOG.info("way {}", human(wayCount)); } Way way = new Way(); /* Handle tags */ for (int k = 0; k < w.getKeysCount(); k++) { String key = getStringById(w.getKeys(k)); String val = getStringById(w.getVals(k)); if (retainTag(key)) way.addTag(key, val); } /* Handle nodes */ List<Long> rl = w.getRefsList(); long[] nodes = new long[rl.size()]; long ref = 0; for (int n = 0; n < nodes.length; n++) { ref += rl.get(n); nodes[n] = ref; } way.nodes = nodes; entitySink.writeWay(w.getId(), way); } } catch (IOException ex) { LOG.error("An I/O exception occurred in the OSM entity sink."); ex.printStackTrace(); } }
@Override protected void parseWays(List<Osmformat.Way> ways) { for (Osmformat.Way w : ways) { AvroWay w2 = new AvroWay(); AvroPrimitive p = getPrimitive(w.getInfo()); p.setId(w.getId()); p.setTags(getTags(w.getKeysList(), w.getValsList())); w2.setCommon(p); long lastRef = 0; List<Long> nodes = new ArrayList<>(w.getRefsCount()); for (Long ref : w.getRefsList()) { lastRef += ref; nodes.add(lastRef); } w2.setNodes(nodes); try { wayWriter.append(w2); } catch (IOException e) { LOGGER.error("Unable to write way", e); } } }
long id = i.getId();
private void processWays( List<Osmformat.Way> ways, PbfFieldDecoder fieldDecoder ) { for (Osmformat.Way way : ways) { Map<String, String> tags = buildTags(way.getKeysList(), way.getValsList(), fieldDecoder); OSMWay osmWay = new OSMWay(way.getId()); osmWay.setTags(tags); // Build up the list of way nodes for the way. The node ids are // delta encoded meaning that each id is stored as a delta against // the previous one. long nodeId = 0; TLongList wayNodes = osmWay.getNodes(); for (long nodeIdOffset : way.getRefsList()) { nodeId += nodeIdOffset; wayNodes.add(nodeId); } decodedEntities.add(osmWay); } }
private void processWays(List<Osmformat.Way> ways, PbfFieldDecoder fieldDecoder) { for (Osmformat.Way way : ways) { Map<String, String> tags = buildTags(way.getKeysList(), way.getValsList(), fieldDecoder); ReaderWay osmWay = new ReaderWay(way.getId()); osmWay.setTags(tags); // Build up the list of way nodes for the way. The node ids are // delta encoded meaning that each id is stored as a delta against // the previous one. long nodeId = 0; LongIndexedContainer wayNodes = osmWay.getNodes(); for (long nodeIdOffset : way.getRefsList()) { nodeId += nodeIdOffset; wayNodes.add(nodeId); } decodedEntities.add(osmWay); } }
private void processWays(List<Osmformat.Way> ways, PbfFieldDecoder fieldDecoder) { for (Osmformat.Way way : ways) { Map<String, String> tags = buildTags(way.getKeysList(), way.getValsList(), fieldDecoder); ReaderWay osmWay = new ReaderWay(way.getId()); osmWay.setTags(tags); // Build up the list of way nodes for the way. The node ids are // delta encoded meaning that each id is stored as a delta against // the previous one. long nodeId = 0; LongIndexedContainer wayNodes = osmWay.getNodes(); for (long nodeIdOffset : way.getRefsList()) { nodeId += nodeIdOffset; wayNodes.add(nodeId); } decodedEntities.add(osmWay); } }
/** * <code>required int64 id = 1;</code> */ @java.lang.Override public long getId() { return instance.getId(); } /**