d3 / d3-geo-projection

Extended geographic projections for d3-geo.
https://observablehq.com/collection/@d3/d3-geo-projection
Other
1.1k stars 201 forks source link

Support All US Territories in Albers USA projection #195

Closed curran closed 4 years ago

curran commented 4 years ago

This projection by @almccon would be amazing to have as part of d3-geo-projection.

image

https://observablehq.com/@almccon/u-s-map-with-puerto-rico

curran commented 4 years ago

Here's a port of that logic to standalone ES6 module: https://github.com/datavis-tech/pleth/blob/4e916c05d7c3375cfdaa00172670c287a15a1205/packages/examples/src/pleth/geoAlbersUsaTerritories.js

image

It was also ported into dirty-reprojectors for use with Mapbox https://github.com/stamen/dirty-reprojectors/blob/master/projections/albers-usa-territories.js

Fil commented 4 years ago

Isn't it a duplicate of https://github.com/d3/d3-geo/issues/152 ?

mbostock commented 4 years ago

Yep, duplicate.

curran commented 4 years ago

The distinction here is that it also includes US Virgin Islands, American Samoa, Guam, and Northern Mariana Islands.

almccon commented 4 years ago

Here's another variant with US Virgin Islands, American Samoa, Guam, and Northern Mariana Islands, but where the Pacific possessions are on the left side of the map. This one seemed to be preferred by most people:

https://observablehq.com/@almccon/u-s-map-with-puerto-rico-us-virgin-islands-american-samoa-gua

Screen Shot 2020-06-19 at 1 30 33 PM

armsp commented 4 years ago

I downloaded the geoshape json files - one projected and another un-projected - from Mike Bostock's example both of which have Puerto Rico.

I am trying to display them in the "albersUsa" projection in Vega or Vega-Lite which uses d3. However I don't see it at all. In the unprojected file, "albersUsa" projection filters Puerto Rico and never displays it. In the projected version there is no map, everything is a giant dark rectangle.

@curran @almccon Any idea how to get it to display in Vega/Vega-Lite?

I see that there are some js files with Puerto Rico too, how do I get them to replace the native d3 js file responsible for the "albersUsa" projection? Perhaps this technique may help me with displaying Puerto Rico too in "albersUsa" projection.

Update - GIS StackExchange Post

curran commented 4 years ago

@armsp It's not recommended to cross-post like this. I responded over in https://github.com/d3/d3-geo/issues/152