Code Monkey home page Code Monkey logo

mrp-api's Introduction

Build Status npm version Dependency Status

A simple NodeJS interface to NASA's Mars Rover Photos API.

Installation

Using npm:

$ npm install --save mrp-api

If you don't have or don't want to use npm:

$ cd ~/.node_modules
$ git clone git://github.com/gmontalvoriv/mrp-api.git

Usage

const mrp = require('mrp-api')('apiKey'); // => your NASA developer API key

const options = {
  /**
   * Earth date on which a photo was taken
   * @type {String|Date object (YYYY-MM-DD)}
   */
  earth_date: '2015-08-03',
  
  /**
   * Martian sol (ranges from 0 to max found in endpoint)
   * @type {Number}
   */
  //sol: 1000,
  
  /**
   * See the camera name abbreviations table here https://api.nasa.gov/api.html#MarsPhotos
   * @type {String}
   */
   camera: 'FHAZ',
   
  /**
   * 25 items per page returned
   * @type {Number}
   */
   page: 1
};

mrp.curiosity(options, function (err, curiosityPhotos) {
  if (err) { console.log(err); }

  console.log(curiosityPhotos);
  
  /*
    Example response:
    
    { photos:
   [ { id: 403763,
       sol: 1063,
       camera: [Object],
       img_src: 'http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01063/opgs/edr/fcam/FLB_491863311EDR_F0482542FHAZ00323M_.JPG',
       earth_date: '2015-08-03',
       rover: [Object] },
     { id: 403764,
       sol: 1063,
       camera: [Object],
       img_src: 'http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01063/opgs/edr/fcam/FRB_491863311EDR_F0482542FHAZ00323M_.JPG',
       earth_date: '2015-08-03',
       rover: [Object] },
     { id: 406290,
       sol: 1063,
       camera: [Object],
       img_src: 'http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01063/opgs/edr/rcam/RLB_491863344EDR_F0482542RHAZ00323M_.JPG',
       earth_date: '2015-08-03',
       rover: [Object] },
       ...
  */
});

mrp.spirit(options, function (err, spiritPhotos) {
  if (err) { console.log(err); }

  console.log(spiritPhotos);
});

mrp.opportunity(options, function (err, opportunityPhotos) {
  if (err) { console.log(err); }

  console.log(opportunityPhotos);
});

Example Images

License

MIT © Gabriel Montalvo

mrp-api's People

Contributors

gamontal avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  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.