You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/02/17 10:37:47 UTC

[GitHub] [superset] Yann-J commented on pull request #18778: other(data): Country map viz: geoboundary downloader + more maps

Yann-J commented on pull request #18778:
URL: https://github.com/apache/superset/pull/18778#issuecomment-1042805842


   Thanks, and kudos to @ktmud as well on the original notebook... the new one is of course very heavily inspired from it, and I'm not python expert myself (and a total geopandas noob), so any feedback appreciated.
   
   There are maybe 2 areas I'd draw some attention to:
   
   - Regarding the quality of the maps, just like with the original script, the source files are a bit heavy and need to be down-sampled. There's clearly some room to tune the `simplify` parameters. The original algorithm used the (angular?) surface of the bounding box as a criteria, which I felt might favor large countries, so I've used its square root instead (i.e. the angular tolerance should be roughly proportional to the country's angular diameter)... Could be improved but the maps I generated for Africa all seemed to come out well...
   - I've initially hit a major hurdle when loading the geojson files produced by geopandas... It took me many hours to figure out, because the files looked perfectly OK, and loaded without issues in all the geojson viewers I've tried, but kept giving a crazy centroid (in fact the antipode of the expected one) / bounding box (the entire world) when loaded in the web UI by D3, throwing off the projection entirely... It turns out that D3 (but apparently not geopandas or even the source files from geoBoundaries, or any geojson viewer I tried??) will respect the geoJSON convention on orienting the polygons, i.e. that the interior of the polygons is expected to be on the right side (or is it the other way?) of the line... If the points are provided in the opposite order, D3 will consider the interior of the polygons to be the rest of the world rather than the intended shape... This is the reason for the ugly hack loading the raw json and applying `reverse` on the `geometry` lists... There
  might be a more elegant way to force that in geopandas / fiona but couldn't figure it out.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org