Skip to content
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

Reprojecting Puerto Rico in albersUsa projection doesn't show it in the map #19

Open
armsp opened this issue Jun 14, 2020 · 5 comments
Open

Comments

@armsp
Copy link

armsp commented Jun 14, 2020

I have a peculiar issue -
I have a shapefile of States from the US Census website which has Puerto Rico. As usual, PR is not shown in albersUsa projection. Doing a web search showed me that I can reproject the file using dirty-reprojectors and make albersUsa projection show PR.

So I used the following command -
cat states.geojson | dirty-reproject --forward albersUsa > states_pr.geojson
However, when I read the states_pr.geojson file in geopandas, then I don't see Puerto Rico like before.
I understand that I am not using d3, rather geopandas, but my understanding was that if PR is reprojected to albersUsa then even geopandas or any other charting library should be able to plot it, right?

@dereklieu
Copy link
Contributor

Hi @armsp unfortunately Puerto Rico is not included in the output of the d3 projection that this library uses under the hood.

Using the command you reference means you're using d3's implementation of albers even if you choose to view the output in geopandas, or qgis, or any other software.

It looks like there has been work done to show Puerto Rico in a custom albers projection. It should be pretty straightforward for someone to add that projection to the ones available in this repo.

@armsp
Copy link
Author

armsp commented Jun 15, 2020

@dereklieu I think I may have completely misunderstood d3/d3-geo#152 and #17
I thought that all I have to do to add Puerto Rico in an albersUsa projection is to use your library.
I got started with GIS a few weeks ago, so I don't think I would be able to do it, but anyways, thanks for the clarification at least.

@soichih
Copy link

soichih commented Dec 8, 2020

I saw this post

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

and I've updated the patch so that it will work with the version of @d3. Now I am seeing Puerto Rico data!

image

Here is the patched version of d3-geo.js

https://github.com/soichih/apred/blob/master/backend/container/d3-geo.js

You can install this by doing something like
$ cp d3-geo.js /usr/local/lib/node_modules/dirty-reprojectors/node_modules/d3-geo/dist/d3-geo.js

Or if you'd like to use my docker container, feel free to use this
cat input.geojson | singularity exec docker://soichih/apred:1.1 dirty-reprojectors --forward albersUsa > output.geojson

@Tmodurr
Copy link

Tmodurr commented May 11, 2023

@soichih are you aware if the approach you took with PR will also work with other US territories (e.g Guam, etc)?

@Tmodurr
Copy link

Tmodurr commented Jun 1, 2023

@soichih are you aware if the approach you took with PR will also work with other US territories (e.g Guam, etc)?

@armsp @soichih pinging this again if you get a sec?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants