GithubHelp home page GithubHelp logo

hhy5277 / kartograph.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kartograph/kartograph.js

0.0 2.0 0.0 1.72 MB

Open source JavaScript renderer for Kartograph SVG maps

Home Page: http://kartograph.org

License: GNU Lesser General Public License v3.0

Shell 0.25% CSS 29.30% JavaScript 3.51% CoffeeScript 66.58% HTML 0.35%

kartograph.js's Introduction

This project is not maintained anymore.

Here are a few reasons why I stopped working on kartograph.js:

  • there's no need to support non-SVG browsers anymore, so if I would touch kartograph.js again I would through out the Raphael.js dependency, which would result in a complete re-write which I don't want to spend my time on, because...
  • d3.js is an amazing library that can do all the vector mapping that you need! Also d3.js has much more map projections and is more fun to work with.
  • Finally, TopoJSON beats SVG as vector geo data format.

So, thanks for the good time we had!

Of course, if you still want to take over from here, kartograph.js is all yours. Just send me an email.


Kartograph.js

Kartograph.js is a JavaScript library that renders SVG maps in web browsers. It is built on top of jQuery and RaphaelJS. Please have a look at the API docs for more details.

Initializing a new map

map = $K.map('#map', 600, 400);
map.loadMap('world.svg', function() {
	map.addLayer('countries', {
		styles: {
			fill: '#ee9900'
		},
		title: function(d) {
			return d.countryName;
		}
	});
});
```

Choropleth maps (aka coloring map polygons based on data):

```javascript
pop_density = { 'USA': 123455, 'CAN': 232323, ... };

colorscale = new chroma.ColorScale({
	colors: chroma.brewer.YlOrRd,
	limits: chroma.limits(chroma.analyze(pop_density), 'k-means', 9)
});

map.getLayer('countries').style('fill', function(data) {
	return colorscale.get(pop_density[data.iso]);
});
```

Adding symbols is easy, too:

```javascript
cities = [{ lat: 43, lon: -75, label: 'New York', population: 19465197 }];

map.addSymbols({
	data: cities,
	location: function(d) {
		return [d.lon, d.lat];
	},
	type: Kartograph.Bubble,
	radius: function(d) {
		return Math.sqrt(d.population) * 0.001;
	}
})
```

### Author

Kartograph was created by [Gregor Aisch](http://github.com/gka/). It is supported by [Piwik Web Analytics](http://piwik.org) and the [Open Knowledge Foundation](http://okfn.org).

### License

Kartograph.js is licensed under [LGPL](http://www.gnu.org/licenses/lgpl-3.0.txt)

kartograph.js's People

Contributors

belerweb avatar gka avatar jonesbp avatar mgax avatar torvalde 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.