Skip to content

Latest commit

 

History

History
97 lines (65 loc) · 2.52 KB

README.md

File metadata and controls

97 lines (65 loc) · 2.52 KB

Road Completion - Scripts

Scripts are built from TypeScript using npm run build.

Generate buffers

Scrip: buffer.js
Source: src/buffer.ts

Description

The buffer.js script will generate a buffer (specified in meters) around each feature in a specified GeoJSON file. The result will be generated in the same folder as the specified GeoJSON file.

Usage

node "buffers.js" -r 10 "path/to/myfile.geojson" "buffers.geojson"

OR

node "buffers.js" --radius=10 "path/to/myfile.geojson" "buffers.geojson"

Convert source field to OpenStreetMap tag

Scrip: convert-tags.js
Source: src/convert-tags.ts

Description

The convert-tags.js script will convert source data field (from a specified GeoJSON file) to OpenStreetMap tag(s) based on a configuration file. The result will be generated in the same folder as the specified GeoJSON file.

Usage

node "convert-tags.js" -c "path/to/convert.json" "path/to/mysource.geojson" "tagged.geojson"

Configuration file: convert.json

{
  "MYSOURCEFIELD": {
    "VALUE1": {
      "OSMTAG1": "OSMTAG1_VALUE",
      "OSMTAG2": "OSMTAG2_VALUE",
      ...
    },
    "VALUES2": {
      ...
    },
    ...
  },
  ...
}

You can use * as value (see VALUE1 or VALUE2 in the example above) to specify all values.

See Brussels, Belgium configuration file or Flanders, Belgium configuration file for reference.

Calculate difference (tile by tile) between source and OpenStreetMap

Scrip: difference.js
Source: src/difference.ts

Description

Using TileReduce, the process does tile by tile:

  1. Normalize all roads and buffers in current tile
  2. Flatten all roads and buffers in current tile
  3. Merge all the OpenStreetMap (+ Map Roulette) with() in current tile
  4. Get all roads that are not entirely within the merged buffer in current tile

Usage

node "difference.js" --output-dir="path/to/directory" "path/to/mysource.mbtiles" "path/to/mybuffers.mbtiles"

Result files

stats.json

Contains statistics about the difference process:

  • Coordinates of the tile ([x, y, zoom_level])
  • Number of roads in the tile
  • Number of buffers in the tile
  • Number of roads that are not entirely within the merged buffer in the tile

diff.geojson

Contains all the roads that are not entirely within the buffers.