Code Monkey home page Code Monkey logo

react-mapfilter's Introduction

MapFilter

MapFilter is a tool for visualizing, exploring, filtering and printing geographic data and geotagged photos and video. It is used by Digital Democracy partners for community environmental monitoring: it allows users to explore the data they have collected and easily create reports of specific time periods or particular issues.

MapFilter expects GeoJSON as input, but is otherwise data agnostic. It will analyze the properties of a GeoJSON file and make a guess at field types and suggest fields to filter. It currently allows for filtering by date range on any date fields, and filtering by discrete fields that have 15 or fewer different values in the dataset.

Data can be visualized as a map, a grid of photos, or a report layout. Additional views can be added via plugins.

The goal is to be simple and easy to use. Our partners want to be able to easily access and explore the data they have collected.

Installation

Using npm:

npm install --save react-mapfilter

To use directly in the browser without a module bundler, the UMD build is also available on unpkg (add this code to the <head> of your HTML doc and you wind find the library on window.MapFilter:

<script src="https://unpkg.com/react-mapfilter/dist/react-mapfilter.js"></script>

Basic Usage

MapFilter is a React component. If you are using a module bundler like browserify or webpack:

var MapFilter = require('react-mapfilter').default
// if you are using an ES6 transpiler, like babel
import MapFilter from 'react-mapfilter'

const features = {
  features: [{
    geometry: {
      coordinates: [-59.9802, 2.8772],
      type: 'Point'
    },
    properties: {
      name: 'Point one'
    }
  }, {
    geometry: {
      coordinates: [-59.9524, 2.4969],
      type: 'Point'
    },
    properties: {
      name: 'Point two'
    }
  }]
}

class Example extends React.Component {
  constructor (props) {
    super(props)
    this.state = {
      features: features
    }
  }

  handleChangeFeatures = (_) => {
    this.setState({features: _})
  }

  render () {
    return <MapFilter
      features={this.state.features}
      onChangeFeatures={this.handleChangeFeatures} />
  }
}

Demo

You can see a demo of the pre-release version of MapFilter here: http://mapfilter.ddem.us

Installation

Clone this repository locally:

git clone https://github.com/digidem/react-mapfilter.git
cd react-mapfilter

Then install dependencies and start the development server:

npm install
npm start

You can then open http://localhost:9966/ in a browser.

API

Offline Preparation

Re-create static map assets (these are checked into git at the moment):

bin/build_style.js example/map_style

Architecture and how to contribute

See CONTRIBUTING.md

react-mapfilter's People

Contributors

gmaclennan avatar mojodna avatar jlev avatar okdistribute avatar kumavis avatar karissa avatar gogocarl avatar robheittman avatar

Watchers

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