Coder Social home page Coder Social logo

geekyrajshri / gisida Goto Github PK

View Code? Open in Web Editor NEW

This project forked from onaio/gisida

0.0 1.0 0.0 26.95 MB

JavaScript library that converts MapSpec layers to beautiful, interactive maps using Mapbox GL

Home Page: http://gisida.onalabs.org/

License: Apache License 2.0

JavaScript 99.98% HTML 0.02%

gisida's Introduction

Gisida is a Javascript data pipeline library that generates map visualizations for Mapbox GL JS using MapSpec.

Gisida uses Redux to manage layers data state.

Take a look at gisida-react if you need to quickly build a Map Dashboard using Gisida and MapSpec layers.

Installation

$ npm install gisida

NOTE: You can alternetively use yarn to manage your node packages.

UMD build

<script src="http://demo.gisida.onalabs.org/assets/js/gisida.js"> </script>

Getting Started

1.Create config file

  • Create a config.json and save it in the application's root path. An example config.json file is provided below:
{
  "APP": {
    "mapConfig": {
      "container": "map",
      "style": "mapbox://styles/mapbox/light-v9",
      "center": [
        36.25
        0.34
      ],
      "zoom": 6
    },
    "accessToken": "<mapbox-studio-access-token>",
    "appIcon": "/img/gisida-logo.png",
    "appName": "GISIDA EXAMPLE",
    "appColor": "darkslategrey",
    "layersPath": "/layers"
  },
  "STYLES": [
    {
      "label": "Light",
      "style": "mapbox://styles/mapbox/light-v9"
    },
    {
      "label": "Streets",
      "style": "mapbox://styles/mapbox/streets-v9"
    },
    {
      "label": "Satellite",
      "style": "mapbox://styles/mapbox/satellite-v9"
    }
  ],
  "LAYERS": [
    "ken-health-sites",
  ]
}

2. Import and initializing the store.

import { initStore } from 'gisida';

const store = initStore();

3. Adding Layers

  • The layersPath propery under APP.mapConfig is used to define the folder that contains the layers files.

  • The LAYERS propery is a list that contains the filenames of the layers that should be loaded into state.

NOTE: The filename is added withouth the .json extension in the config file.

An example layer file in the path /layers/ken-health-sites.json

{
  "label": "Kenya Health Sites",
  "source": {
    "type": "geojson",
    "data": "data/ken_health_sites.geojson"
  },
  "type": "symbol",
  "minZoom": 0,
  "paint": {
    "text-color": "#000",
    "text-halo-color": "#fff",
    "text-halo-width": 1.3,
    "text-halo-blur": 1
  },
  "layout": {
    "text-field": "{name} ({type})",
    "text-offset": [0,2],
    "icon-image": "hospital-11",
    "icon-allow-overlap": true,
    "text-transform": "uppercase"
  },
  "visible": false,
  "credit": "Global Healthsites Mapping Project<br>Aug 15, 2017"
}

Ensure that the data file for the layer is located in the specified source path data/ken_health_sites.geojson.

3. Actions

Gisida provides in-build functions that trigger to process and managed data in the store;

  • prepareLayer
  • changeStyle
  • addLabels
  • addChart
  • addLegend
  • buildTimeSeriesData

TODO: add documentation for Gisida API

Development

To locally develop and make changes to gisida:

Local development

  • Clone repo:
$ git clone [email protected]:onaio/gisida.git
  • Link the project folder as local module within your project using npm link or yarn link if you use yarn as your preferred node package manager.

  • Run development build:

$ npm develop

Production build

  • Build production distribution
$ npm build
  • Publish to npm
$ npm publish

Releases

  1. Check https://github.com/onaio/gisida/releases to see what the next release version number should be, i.e. if the last release is 0.0.7 the next should be 0.0.8 depending on the Semantic Versioning guide, refer to (https://semver.org/).

  2. Create branch for new version being released, git checkout -b <version-number>

$ git checkout -b 0.0.8
  1. Run npm version <version-number>. This creates a commit and updates version number in package.json.
$ npm version 0.0.8
  1. Push release branch to Github and tag git push -u --follow-tags origin <version-number> e.g
$ git push -u --follow-tags origin 0.0.8
  1. Merge release to master once it passes review

gisida's People

Contributors

kipsigei avatar royrutto avatar kahummer avatar mps114 avatar moshthepitt avatar ukanga avatar morrismukiri avatar rowo avatar pld avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.