Code Monkey home page Code Monkey logo

openmrs-webgl-globe's Introduction

Build Status

The OpenMRS WebGL Globe is a fork from chromeexperiments to visualize openrms implementers data provided at openmrs atlas.

Check out the examples at http://www.chromeexperiments.com/globe, and if you create a globe, please share it with us. We post our favorite globes publicly.


The WebGL Globe supports data in JSON format, a sample of which you can find here. webgl-globe makes heavy use of the Three.js library.

Data Format

The following illustrates the JSON data format that the globe expects:

var data = [
    [
    'seriesA', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
    ],
    [
    'seriesB', [ latitude, longitude, magnitude, latitude, longitude, magnitude, ... ]
    ]
];

Basic Usage

The following code polls a JSON file (formatted like the one above) for geo-data and adds it to an animated, interactive WebGL globe.

// Where to put the globe?
var container = document.getElementById( 'container' );

// Make the globe
var globe = new DAT.Globe( container );

// We're going to ask a file for the JSON data.
var xhr = new XMLHttpRequest();

// Where do we get the data?
xhr.open( 'GET', 'myjson.json', true );

// What do we do when we have it?
xhr.onreadystatechange = function() {

    // If we've received the data
    if ( xhr.readyState === 4 && xhr.status === 200 ) {

        // Parse the JSON
        var data = JSON.parse( xhr.responseText );

        // Tell the globe about your JSON data
        for ( var i = 0; i < data.length; i ++ ) {
            globe.addData( data[i][1], {format: 'magnitude', name: data[i][0]} );
        }

        // Create the geometry
        globe.createPoints();

        // Begin animation
        globe.animate();

    }

};

// Begin request
xhr.send( null );

Starting a local development server

npm install
npm start

Navigate to http://localhost:3000 to see the demo.

Tested with Node 5.7 and npm 3.6.

Deploy to Heroku

  1. Create a Procfile
touch procfile
nano procfile
  1. Add this line to the procfile-
web: node index.js
  1. Follow the steps on the website to download heroku-cli https://devcenter.heroku.com/articles/getting-started-with-nodejs#set-up after that
heroku login
  1. In the terminal go to your repo or clone it & cd into it
git clone https://github.com/Foo/Bar.git
cd Bar
  1. Create a heroku app, a random name gets generated & its git remote is added
heroku create

git push heroku master
  1. To view your app
heroku open

Wanna know some more regarding openmrs?

OpenMRS

  • OpenMRS is a collaborative open source project to develop software to support the delivery of health care in developing countries
  • OpenMRS

OpenMRS Atlas

  • The OpenMRS Atlas is a website on which members of the OpenMRS Community can register their site(s). The Atlas serves not only to let the world know about your site, but also help sites to discover other implementations in their region.
  • OpenMRS Atlas

openmrs-webgl-globe's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

openmrs-webgl-globe's Issues

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.