clarisma / geodesk-py

Fast and storage-efficient spatial database engine for OpenStreetMap data
https://docs.geodesk.com/python
GNU Lesser General Public License v3.0
36 stars 0 forks source link

Use equal-area projection for area calculation #22

Open clarisma opened 8 months ago

clarisma commented 8 months ago

Currently, Feature.area uses a Euclidian algo (scaled to latitude), which suffers from loss of accuracy near the poles. Accuracy would improve by re-projecting coordinates into an equal-area projection, with only a small decrease in speed (?? - see comment below)

clarisma commented 7 months ago

Comparison of Fast (scaled Mercator projection -- current approach) and Accurate (Lambert projection). Difference isn't dramatic. Fast, however, is 5x faster than Accurate.

(Greenland is way off because we're comparing the larger admin area in OSM to the land area stated in Wikipedia).

                            Area (in square km)
Name                        Fast         Accurate     Wikipedia
-------------------------   ----------   ----------   ----------
Araucania (Chile)             31869.80     31766.66     31842.30
Baffin Island                519325.54    510095.64    507451.00
Bavaria                       70552.73     70354.87     70550.19
Germany (land area)          354626.80    356287.03    357600.00
Greenland (admin area)      2414716.20   2534771.03   2166086.00
Komsomolets Island             8724.11      8821.01      9006.00
Meighen Island                  934.37       925.45       955.00
Nordaustlandet                14186.02     14224.67     14443.00
Tarapaca (Chile)              42608.18     42547.26     41799.50
Saarland (Germany)             2570.34      2563.73      2570.00
Sakhalin (Russia)             74632.04     74316.81     72492.00
Victoria Island (Canada)     215938.80    218829.33    217291.00
Victoria Island (Russia)          5.98         5.97        10.80