-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Puerto Rico in Albers USA projection #152
Comments
Not for me to decide, but I would tend to think it a good idea and I don't see a drawback. If you want the map w/o PR, you could filter out PR from your features… the only strange case I'm thinking of is, if you're using the inverse proj in that (oceanic) region. |
@kevinahuber, it looks like you pulled in the U.S. Virgin Islands along with P.R... was that on purpose? |
I'd rather not see this added to albersUsa, but would be for adding a albersUsaPr. |
One disadvantage I see here is that the counties in Puerto Rico are drawn very small at the scale that's being used in @Fil's diagram and thus difficult to read. That could potentially be overcome by trying to maximize the real estate for it in the lower right corner of the map frame. Another point worth considering is that Puerto Rico is one of many territories the U.S. holds, and not a state. U.S. Albers projection is specifically meant for representing the lower 48 states, d3 albersUsa is a composite projection that includes the two non-lower 48 states so that all 50 states can be included in a single map which is a common use case. Puerto Rico is often treated as a U.S. state in news coverage and sometimes included in this composite projection, but more than often it isn't. My vote would be for a separate composite projection that includes Puerto Rico, because it's often not included when mapping data of the U.S. states & counties. If it was to be included by default then users of the projection would have to manually filter it out when it's not needed, which doesn't seem ideal to me. |
(Sorry, misclick.) |
Here’s an updated implementation: https://observablehq.com/@d3/u-s-map-with-puerto-rico It would be nice to generalize this so that we don’t need as much code duplication with the existing geoAlbersUsa. Contributions welcome. |
Does this seem like a reasonable approach to reducing said duplication? If so I can clean it up and turn it into a PR. |
Hey, thanks @jake-low! That looks promising. One thought I had is whether it’s worth designating the first projection in the list as the “primary” projection, and the others as “inset” projections, with the requirement that the insets are exclusive (non-overlapping) and contained within the clipExtent of the primary projection (if there is a clipExtent). The for doing the inverse projection, you’d test the projections in reverse order so that the primary’s inverse is only used if the given point is not within an inset. |
Since d3/d3-geo-projection#195 was closed as a dupe of this, I thought I might add: This issue is also about including
in the projection. |
Renamed the closed issue to Support All US Territories in Albers USA projection to clarify. |
Here's my preferred option, with American Samoa, Guam, and Northern Mariana Islands in the left corner (which makes sense because they're in the Pacific, and therefore should probably be shown to the left of the US, not the right). https://observablehq.com/@almccon/u-s-map-with-puerto-rico-us-virgin-islands-american-samoa-gua |
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 |
@armsp I think you need to register a custom projection extension with Vega, using vega.projection. |
@almccon and I put together a geo-albers-usa-territories package. Feedback welcome! |
Edit--realized I forgot to express gratitude for all of your your work on this library, which is such an impressive achievement that I use frequently. Thank you! Is it too late to reopen the question of whether @curran and @almccon's great work here should replace geoAlbersUsa in Puerto Rico et al. are part of the US. Actively excluding them should be a decision by whoever makes the dataset. If the US census bureau puts them in a shapefile of roads or McDonald's puts them in a csv of US restaurant locations, why would With the current setup, I often don't even realize that Puerto Rico is being deleted from maps where I would have liked it to appear until it raises an unexpected error. E.g. I ended up here today after trying to access the 'coordinates' property of each polygon in a feature collection of the US. Certainly it's true that lots of people don't expect to see the territories in a map of the US, especially if they're just plotting some global-scale data. But that expectation is bad! Here's a recent book with an on-topic cover that's been widely discussed in the historical profession recently. |
I agree with @bmschmidt, and that was the original intent of raising this issue. Thank you for raising this and providing additional details! |
(Just added a thank you to the authors/maintainers in the first post here, which I somehow omitted the first time). Out of curiosity, went poking around some of the most popular AlbersUsa maps on observable to see if they have Puerto Rico (FIPS 72) data in the underlying set being dropped. It's really common. For instance, there is suppressed PR data in:
The only case here where I think the creator might have actively wanted to remove PR is for the bivariate choropleth, where it seems obesity may be missing. |
Totally open to do whatever is required to migrate features from geo-albers-usa-territories into mainline D3! |
Any movement on this? Having this additional option for albersusa in would save a lot of people a lot of time, as right now everyone seems to be getting along by having to do a lot of reading and eventually doing something like monkey-patching a modified d3-geo version into their project |
Also wondering where this is at. Kind of odd that there's no option to include these US territories in a US map. |
I see four options for including PR and the rest.
I support 4 at the next major version bump on the grounds that most plots that drop PR are doing it accidentally. I would also support 3. 1 and 2 would make it harder for users of downstream packages (eg vega-lite) to make a decent map of the whole United States. |
In the Philippe Rivière diagram (and others), the Albers USA projection includes Puerto Rico
Would there be an objection to including that in
albersUsa.js
?The text was updated successfully, but these errors were encountered: