markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

Extend funcionality to other countries #1

Closed rafagarcia closed 11 years ago

rafagarcia commented 11 years ago

Impressive work. It would be a hit if it could be extended to other countries.

markmarkoh commented 11 years ago

agreed. Currently it's "whole world" or "just USA". I want to add different zoom levels to different continents.

So maybe:

$("#map").datamaps({ zoom: 'SouthAmerica' });

Which would essential be a World map but zoomed in on the center of South America.

You think that would be enough?

ckiikc commented 11 years ago

Is there a way to buil your js coordinates starting from gps one?

markmarkoh commented 11 years ago

You can now specify scopes such as:

with the latest version.

after commit: https://github.com/markmarkoh/datamaps/commit/5f9ca3b1c70bd3f853442043c7635d75a55cb5db

markmarkoh commented 11 years ago

example at http://datamaps.github.com/#scopes

rafagarcia commented 11 years ago

Great work indeed.

maerkip commented 10 years ago

Is this no longer supported in the newest version? It's working fine for scope world and usa, but for other scopes I get this error:

[03:27:49.989] TypeError: a is undefined @ http://localhost:8888/datamaps/datamaps.all.min.js:1

kylemclaren commented 10 years ago

Hi there,

zoom doesn't appear to be supported anymore? I'd like to "zoom" in on Africa only.

Will I need to get custom map data or is there some way that is supported out the box?

kylemclaren commented 10 years ago

Never mind, I've just seen the "zoom" branch. Will give it another attempt.

markmarkoh commented 10 years ago

@kylemclaren: you don't need custom map data, but you probably want to take advantage of a custom projection.

For Africa, it'd look something like this:

http://jsbin.com/EjOHuliN/2/edit

You can mess with the scale, center and translation to move it into place.

The zoom branch is outdated, I changed my approach to zooming by exposing more d3 instead of abstracting it (as in, allowing you to specify your projection and all the options).

kylemclaren commented 10 years ago

@markmarkoh Brilliant! Thanks for the quick reply. Let me see what I can make happen...

idekov-hf commented 8 years ago

Hey, how would I get a map centered on Europe?

trsonderm commented 8 years ago

@ivdekov change your projection to europe:

var projection = d3.geo.equirectangular()
        .center([10, 50])
        .rotate([4.4, 0])
        .scale(1500)
        .translate([element.offsetWidth / 2, element.offsetHeight / 2]);
      var path = d3.geo.path()
        .projection(projection);
dharmjit commented 8 years ago

Hi All, this is an awesome library and I am using custom map feature of it. I have Senegal Topojson and its not showing in the visual area. I guess I need to set projection correctly, but I am not getting anywhere near to find the values for scale,translate and center. Is there any method to find the values of scale and translate. Thanks

FreelanceWebNinja commented 7 years ago

Sorry for the necropost(?), but it appears the additional scopes are not working:

Uncaught TypeError: Cannot read property 'objects' of undefined

Anujarya300 commented 7 years ago

@markmarkoh Really appreciated the work you guys have done. But the datamap only supports for World and USA map and no other countries. But I need to use Canada, Brazil maps.

Can you help me how to use the maps of other countries or give me some idea about the map data and rendering, so that I can fix it.

Thanks!

Anujarya300 commented 7 years ago

By doing some brain storming in the weekend, able to come up with something. I have created demo files for India, Canada etc which shows bubble map. https://github.com/Anujarya300/bubble_maps.

Thanks @markmarkoh

markmarkoh commented 7 years ago

@Anujarya300 that looks really great. I'd love to have that README available in this project, along with those examples. Feel like sending a pull request?

Anujarya300 commented 7 years ago

@markmarkoh, Sure, I'd love to put a pull request.

mcv commented 6 years ago

I notice all zoom examples use hard-coded coordinates. It would be nice if it was possible to get these coordinates from the continent you're zooming in on. This is possible with countries, but I have no idea if this is also possible with continents. You may have to compare all the bounding boxes of all the countries in that continent, take the min and max of that, and then average the min and max.