Skip to content

klokantech/ocad2geojson

 
 

Repository files navigation

OCAD to GeoJSON

Work in progress to export OCAD files to open formats, primarily GeoJSON and Mapbox Style Spec, to put some more GIS in the orienteering world.

Example Map Output Example Map Output Example Map Output

Demo: OCAD map viewer and converter in your browser

You can use this to get geo/GIS data out of an OCAD file. This is currently more or less three modules working together:

  • OCAD file reader, to get meaningful data out of the binary OCAD files
  • OCAD to GeoJSON, to export the geographic objects from OCAD files
  • OCAD to Mapbox GL style, to get the styling (colors, line widths, etc.) into something you can use with other tools

OCAD version 10, 11 and 12 files are mostly supported.

Usage

const { readOcad, ocadToGeoJson, ocadToMapboxGlStyle } = require('../')

readOcad(filePath)
  .then(ocadFile => {
    const geojson = ocadToGeoJson(ocadFile)
    console.log(JSON.stringify(geojson))
    const layerStyles = ocadToMapboxGlStyle(ocadFile)
    console.log(JSON.stringify(layerStyles))
  })

The argument to readOcad can either be a file path (string) or a Buffer object.

Command line

There is also a command line utility in cli.js which you can look at and use, but docs will have to wait.

License

Since I highly dislike the closed source nature of some of the software used in orienteering (well, mostly OCAD), this software is licensed under AGPL-3.0; in short, to use this software, you must distribute source.

Packages

No packages published

Languages

  • JavaScript 100.0%