datamaps icon indicating copy to clipboard operation
datamaps copied to clipboard

Extend funcionality to other countries

Open rafagarcia opened this issue 13 years ago • 19 comments

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

rafagarcia avatar Dec 12 '12 17:12 rafagarcia

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?

markmarkoh avatar Dec 12 '12 18:12 markmarkoh

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

ckiikc avatar Dec 13 '12 02:12 ckiikc

You can now specify scopes such as:

  • southAmerica
  • middleEast
  • africa
  • europe
  • asia
  • southeastAsia
  • australia
  • world
  • usa

with the latest version.

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

markmarkoh avatar Jan 14 '13 06:01 markmarkoh

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

markmarkoh avatar Jan 14 '13 20:01 markmarkoh

Great work indeed.

rafagarcia avatar Feb 18 '13 08:02 rafagarcia

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

maerkip avatar Nov 04 '13 02:11 maerkip

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 avatar Jan 28 '14 15:01 kylemclaren

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

kylemclaren avatar Jan 28 '14 16:01 kylemclaren

@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).

markmarkoh avatar Jan 28 '14 17:01 markmarkoh

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

kylemclaren avatar Jan 28 '14 20:01 kylemclaren

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

idekov-hf avatar Jan 30 '16 17:01 idekov-hf

@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);

trsonderm avatar Feb 16 '16 14:02 trsonderm

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

dharmjit avatar Sep 08 '16 05:09 dharmjit

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

Uncaught TypeError: Cannot read property 'objects' of undefined

FreelanceWebNinja avatar May 26 '17 13:05 FreelanceWebNinja

@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 avatar May 27 '17 08:05 Anujarya300

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

Anujarya300 avatar May 29 '17 23:05 Anujarya300

@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?

markmarkoh avatar May 30 '17 14:05 markmarkoh

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

Anujarya300 avatar May 31 '17 20:05 Anujarya300

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.

mcv avatar Oct 16 '17 11:10 mcv