GithubHelp home page GithubHelp logo

earnestm / leaflet-map-polygon-hover Goto Github PK

View Code? Open in Web Editor NEW

This project forked from handsondataviz/leaflet-map-polygon-hover

0.0 1.0 0.0 101 KB

Leaflet thematic polygon (choropleth) map, with hover info window, using GeoJSON data

Home Page: http://jackdougherty.github.io/leaflet-map-polygon-hover/index.html

License: MIT License

HTML 16.14% JavaScript 74.83% CSS 9.02%

leaflet-map-polygon-hover's Introduction

leaflet-map-polygon-hover

Leaflet thematic polygon (choropleth) map, with hover info window, using GeoJSON data

Demo

Benefits

  • This GeoJSON version is simpler for novices to understand, since they can create and join GeoJSON data file in MapShaper.org
  • Works in iOS and Android mobile devices

Compare with

Credits

Create your own

See tutorial in the Leaflet Template section of Data Visualization for All book http://DataVizForAll.org

####General overview of steps below

  • Join a GeoJSON polygon map with spreadsheet data
  • Modify color ranges and info box text & variables as needed
  • Upload all files to a forked or new GitHub repository, create GitHub pages branch for live web host

####Detailed steps:

  • Start with GeoJSON polygon map with no numerical data, such as: ct-towns-borders.geojson

  • Import polygon map into http://MapShaper.org. Simplify to reduce size as needed.

  • Export as CSV to create spreadsheet of polygon names. In this example, column header is "town"

  • Open CSV with any spreadsheet tool. Insert columns of data into the CSV sheet. Use VLOOKUP function if needed.

  • Save CSV with new name: ct-towns.csv

  • Import ct-towns.csv as second layer into MapShaper.org.

  • Use the drop-down to select the polygon map (ct-towns-borders.geojson) as the active, displayed layer.

  • Click the Console and enter command to join the CSV table to the GeoJSON polygon

    -join ct-towns.csv keys=town,town
    
  • Export the newly joined map with a new filename in GeoJSON format: ct-towns-density.json)

  • Change the file name suffix from .json to .geojson to avoid confusion

  • Fork this GitHub repository, or create your own, with these files (or equivalent):

    • index.html
    • script.js
    • style.css
    • ct-towns-density.geojson (the data file)
  • in index.html, adjust the reference to the data file

  • in script.js, adjust the hover info box text and references as needed

  • in script.js, Adjust the ranges with http://colorbrewer.org

leaflet-map-polygon-hover's People

Contributors

jackdougherty avatar earnestm avatar npmcdn-to-unpkg-bot avatar

Watchers

 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.