0.1.3 • Published 5 years ago

minicarto v0.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

miniCarto.js

MiniCarto is a mapping abstraction library, written according to gist.

Demo

MiniCarto has three goals:

  • it takes configuration file with some properties and renders map and layers using one of popular mapping libraries. At demo page I switch between Leaflet and OpenLayers. The design of miniCarto is abstract enough to easy add new mapping libraries easy (e.g. Google Maps or d3.js).
  • it handles map layers visibility using abstract TileLayer class (all layers in this demo are rendered as tiled layers)
  • it updates sql attribute of CartoDB tiled layer and rerenders it.

To test library from console, I expose it at demo page into global namespace as window.miniCarto.

Installation

npm install minicarto
import miniCarto from 'minicarto';

miniCarto.init(...);

Usage

API reference

miniCarto

MethodDescription
init(config Object, container HTML Element, library String)Initializes miniCarto with params. Reads config file, then creates map with layers and draws them in container using library. Default library is 'leaflet'.
setLibrary(String, 'leaflet' | 'openLayers')Sets library, recreates map with layers and draws them.

miniCarto.map

MethodDescription
addLayer(layer miniCarto.Layer)Adds layer to the map. Inside adds library layer to library map.
removeLayer(layer miniCarto.Layer)Removes layer from the map. Inside removes library layer from the library map.
hasLayer(layer miniCarto.Layer)Checks if map has layer already.

miniCarto.map.layer

MethodDescription
setVisibility(visible Boolean)Handles layer visibility.
update(options Object)Updates layer with options. Inside requests layer data and redraws it.
0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago