missinglink / pbf

utilities for parsing OpenStreetMap PBF files and extracting geographic data
MIT License
21 stars 9 forks source link

format: pelias #2

Closed missinglink closed 7 years ago

missinglink commented 7 years ago

work in progress

support for producing output compatible with the output of https://github.com/pelias/pbf2json

example runner.sh:

#!/bin/bash

NAME='single';
PBF_FILE='/var/www/pbf2json/test/vancouver_canada.osm.pbf';
CONFIG_FILE="example/${NAME}.json";
MASK_FILE="example/${NAME}.mask";
JSON_FILE="example/${NAME}.extract.json";
LEVELDB_DIR='/tmp/leveldb';

# clean up
rm -rf "${MASK_FILE}";
rm -rf "${JSON_FILE}";
rm -rf "${LEVELDB_DIR}";
mkdir -p "${LEVELDB_DIR}";

echo 'build';
time go build pbf.go;

echo 'generate mask';
time ./pbf genmask -c "${CONFIG_FILE}" "${PBF_FILE}" "${MASK_FILE}";

echo 'mask stats';
./pbf bitmask-stats "${MASK_FILE}";

echo 'store noderefs';
time ./pbf store-noderefs -m "${MASK_FILE}" -l "${LEVELDB_DIR}" "${PBF_FILE}";

echo 'extract json';
time ./pbf pelias -m "${MASK_FILE}" -l "${LEVELDB_DIR}" "${PBF_FILE}" 1> "${JSON_FILE}" 2> "${ERROR_FILE}";
$ cat example/single.json 
{
  "node": [
    [ "building" ]
  ],
  "way": [
    [ "building" ]
  ]
}