[OpenLayers-Users] How to validate OpenLayers area calculation using PostGIS?

Phil Scadden p.scadden at gns.cri.nz
Tue Sep 23 19:10:19 PDT 2014


Okay that made me actually look at the code in OL (I made a patch for 
dateline crossing polygons quite a while ago, but never really looked 
further). getGeodesicArea is approximation on sphere based on 
http://trs-new.jpl.nasa.gov/dspace/handle/2014/40409

Needs closely spaced vertices to have a hope I would say. Doing a proper 
ellipsoid calculation isnt trivial. Looking it over, I think think I 
would be very tempted to pass the geometry to the server and calculate 
it properly there rather than try to implement the code in JS. However, 
you could possibly get a reasonable approximation from equal area. ie 
you take the geometry and work out parallels and centre Longitude for an 
albers equal area conic projection. Project the geometry into that with 
ProjJS. Get the area of the projected geometry with getArea. For very 
large, very simple geometries this is still probably missing some 
precision but I would suspect you would still get within a km2 or so. 
Obvious ways
to improve it however require densifying by calculation of extra points 
between vertices calculated on a great circle. I've got this stuff in 
our corporate java libraries so I would go to the server to do it.


Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Users mailing list