java - Geometry.getarea() and Polygon.getarea() what are the units? -


so working set of images the corners lat long on map. creating polygons check if there overlap of given images. need know units associated .getarea() methods both polygon , geometry. i'm using following objects create polygons , geometry

http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/geom/geometry.html#getarea() http://www.vividsolutions.com/jts/javadoc/com/vividsolutions/jts/geom/polygon.html

when using both of above objects number have found no indication on units associated number are. talking meters, kilometers, miles?

a sample of cordinates i'm using +30.658739 -086.345670, +30.659997 -086.34002, +30.664041 -086.345082, +30.662783 -086.342750 i'm looking area between these 4 points.
value .getarea() 1.31039680000139e-5 points realitively close i'm thinking in meters 1310.4 meters

this difficult tell without knowing underlying coordinate system is. after taking quick glance @ javadoc api linked to, suspect geometry package dealing in raw cartesian coordinates , agnostic units of measurement being used. if case, on slippery slope. here's problem:

not degrees created equal

degrees in latitude have same spatial resolution. each degree of latitude corresponds 111km of distance. not case degrees of longitude. @ equator, degrees of longitude correspond 111km of distance, @ poles, 1 degree of longitude has 0 km of distance. in other words, if have lat/lon box upper left @ 10:0 , lower-right @ 0:10, have more surface area lat/lon box upper left @ 20:0 , lower-right @ 10:10, though sides of boxes 10 degrees long.

a second issue curvature of earth. because of earth's curvature, 100km 100km square on earth's surface have more surface area 10000 km^2, because shortest distance 1 point on earth's surface not straight line, arc.

a third , often-overlooked less-important issue earth not sphere, ellipsoid. tends bulge near equator, breaks our assumption degree of latitude anywhere on earth same distance degree of latitude anywhere else. however, issue not introduce error our surface area estimates first two.

in other words, spherical (or in reality, ellipsoidal) surface area isn't easy problem solve, @ least not easy mapping cartesian coordinates , using them find euclidean measurements of surface area. can away if surface area dealing spans small angular distance, larger lat/lon box is, more distortion get.

possible solution

this works if images rectangular , top/bottom of image have constant latitude left-to right. still introduces more error wider ranges of latitude because still ignores curvature of earth, better job assuming degrees created equal in cartesian coordinate system. if case, intersection of image bounded following coordinates:

toplat:*leftlon*, bottomlat:*rightlon*

calculate average latitude, use find distance per degree of longitude @ average latitude, kmperlon. have following equation:

area = ((toplat - bottomlat) * 111km) * (rightlon - leftlon) * kmperlon)

the area measured in square kilometers, again, i'd reiterate works reasonably if images rectangularly aligned parallel latitudes , not span angular distance.


Comments