Skip to content

nessig/d3_geojson_example

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 1 commit ahead of vlandham:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
js
 
 
 
 
 
 
 
 

A really quick example of getting geoJSON to display using D3

This repo is part of the From Shapefile to geoJSON post.

About

Check out coffee/vis.coffee for the implementation.

Also, this example has been reworked with a JavaScript only version in js/vis.js.

Pick your poison!

Running

You can start up a local webserver by using python’s simple server:

python -m SimpleHTTPServer 3000

or thin in ruby

thin start
# might have to run 'bundle install' first

Now go to http://0.0.0.0:3000

and you have a basic visualization

OR – I’ve been using node’s http-server as of late, which works just as well.

You need to have it installed:

npm install -g http-server

Then you just run http-server in the root directory of your site:

http-server ./

Now go to http://0.0.0.0:8080

Inspiration

As detailed in the post, most of this code comes from Bostock’s Choropleth Example .

Automatically figuring out the boundaries and scale of the projection comes from another Bostock example .

About

Example of using d3 to display geojson generated from a shapefile

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CoffeeScript 39.9%
  • HTML 28.6%
  • JavaScript 19.5%
  • Ruby 12.0%