kothic

0.2.8 • Public • Published

Kothic JS is a full-featured JavaScript map rendering engine using HTML5 Canvas.

NPM version License Build Status

It was initially developed as a JavaScript port of Kothic rendering engine written in Python.

kothic-node is a KothicJS port, designed to work as a server-side renderer. Due to incompatibility with original KothicJS in almost every aspect, it deserves a separate repository.

Unlike original KothicJS kothic-node isn't limited to rendering OpenStreetMap data only. Any geo data in GeoJSON will be ok.

Instead of using HTML5 Canvas, kothic-node relies on node-canvas module.

Warning: kothic-node is a subject of active (but very slow) development and it's not intended for production use yet.

Features

  • Rendering any GeoJSON to an image
  • Native MapCSS support without any additional data preparation
  • GeoJSON as an internal data representation format
  • Browser-compatible design, no NodeJS specific API is used
  • As little dependencies as possible

Basic usage

Install the library npm i kothic

const css = "way { width: 1; color: red;}";
const kothic = new Kothic(css, {
  //Synchronous mode for testing reasons
  getFrame: (callback) => callback(),
  browserOptimizations: false,
  gallery: {
    localImagesDirectory: '../../sandbox/maki/png'
  },
  mapcss: {
    cache: {},
    locales: []
  },
  debug: true
});

Kothic.render(
	canvas, // canvas element (or its id) to render on
	geojson, // GeoJSON data to render
	zoom, // zoom level
	callback, // onRenderingComplete callback
);

locales Kothic-JS supports map localization based on name:lang tags. Renderer will check all mentioned languages in order of persence. If object doesn't have localized name, name tag will be used.

Contributing to Kothic JS

Kothic JS is licensed under a BSD license, and we'll be glad to accept your contributions!

Core contributors:

Readme

Keywords

none

Package Sidebar

Install

npm i kothic

Weekly Downloads

0

Version

0.2.8

License

BSD-2-Clause

Unpacked Size

145 kB

Total Files

50

Last publish

Collaborators

  • miroff