Hacker News new | past | comments | ask | show | jobs | submit login

> We cannot use those (xi,yi)(xi,yi) directly, because they come from a Mercator projection of the earth, thus they are distorted. I had to apply a transformation to them in order to get coordinates that aren’t distorted. In order to do that I used the pyproj library.

Nitpick: you apply a transformation where they are less distorted. There is no "distorsionless" mapping from R^2->sphere. A more accurate approach would be to use spherical geometry to calculate the actual areas, but I doubt that it would change the values too much though.

Also I would be curious what was the exact projection you used and how you choose the parameters for each country.




What I do is the following: For each country, I transform its points from the equirectangular projection I'm given to an azimutal projection centered in some point (that depends on the country).

That point is obtained by computing the midpoint of two random points from the border of the country.

I know it is not the best (if the country is not convex, then the midpoint isn't necessarily inside it), but it works. The code is at the end of the post, if you want to take a look at it.

Thanks for pointing that out though, I'm going to add this to the post.

Edit: you were right, it wasn't even the Mercator projection, it was the equirectangular projection. Thank you!


Also Natural Earth provides data in WGS84 which is an unprojected, geographic system. They are latitude and longitude and have pretty much nothing to do with Mercator projections.

edit: They used "azimuthal projection centered in each country". That's good!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: