Open armsp opened 4 years ago
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.
@dereklieu I think I may have completely misunderstood https://github.com/d3/d3-geo/issues/152 and https://github.com/developmentseed/dirty-reprojectors/issues/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.
I saw this post
and I've updated the patch so that it will work with the version of @d3. Now I am seeing Puerto Rico data!
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
@soichih are you aware if the approach you took with PR will also work with other US territories (e.g Guam, etc)?
@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?
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 thestates_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?