score:12

Ah now I've looked into it I can see you had the coordinates the correct way round for D3. I've set up this bl.ock that plots those points for you.

I apologise if you're already on top of this but I'll provide some background to start with. The aim of projections is to translate 3D positions into 2D plane (or the screen). There are numerous different projections out there that stretch and bend 3D coordinates into the 2D plane and exactly how this is done reflects the desired outcomes of the projection designers. Some projections will be better suited to the USA, the Albers USA is a good example of this as it moves Alaska and Hawaii to the south west of California. This is really a long winded way to say that for a given set of earth coordinates different projections will get different screen coordinates. To get an understanding of this have a look at Jason Davies page or this bl.ock by Mike Bostock.

Now you're on the right path with projection you just need to set-up how D3 will translate those coordinates to the screen. There are a number of ways to do that but I outline here is the one I find easiest to understand. There are a number of parameters you can set when using projection, these include scale, centre, translate, rotate, etc. What they do is pretty strait forward. The scale sets the zoom with a larger number resulting in more zoomed in map, centre sets the centre point of the map in coordinates, translate sends the centre of a map to screen location and rotate rotates the map.

In the bl.ock I set up I've just used the scale and centre parameters as in:

projection
  .scale(1000)
  .center([-106, 37.5])

To see exactly how this works change these parameters around, try increasing the scale so you can where the points are and remember to set the center to one of the points to make sure that you can see them.


Related Query

More Query from same tag