The projection named ISEA - Icosahedral Snyder Equal Area has a (supposedly) good implementation in the PROJ Library, proj.org/isea, that is used by PostGIS, QGIS, etc.
The example is agnostic - was expressed in standard SQL with no software dependence.
Problem: bad results, seems that I am not using correct resolution or other parameter in the ISEA definition.
I tried it first with +proj=isea
, but the result seems wrong (PROJ Library bug?). See "use case" below. I changed to +proj=isea +resolution=1.0
and other values (0.1, ..., 40.0) and no effect, no changes in the result.
Supposing that PROJ Library has no bug, the question is "How to use ISEA?"
Use case
SELECT ST_Area(box_geom,true) as area, -- in meters
ST_Area( ST_Transform(box_geom,isea_proj) ) as isea_area
FROM (
SELECT '+proj=isea', -- +resolution=1.0
ST_SetSRID(ST_GeomFromGeoHash('6gyf4bf'), 4326)
) t1(isea_proj,box_geom);
Result: area=21326 and isea_area=21424, so a significative difference of 0.46%.
Note: calculationg percentual difference by abs(area-proj_area)/area
.
A change in projection can't affect area, only when PostGIS do some internal calculation error. The usual in projection-change is something as ~0.0001% or less. The ~0.5% result is big!
PS: the used Geohash, 6gyf4bf
, is a box located at Brazil/São Paulo. Using other box, at Equador/Quito (6rbntru
) or Chile/Terra del Fuego (4qqhz1e
) the error is the same.
The question ended here... Below a complement to remember me the other checks that I've done.
A complete use case to compare
Bellow I will compare with another equal-area projection, valid for Brazilian territory... It shows that PostGIS is working fine, and a good projection not affects area calculations.
Check a landmark point of GeoURI geo:-23.550385,-46.633956
and a small box containing it, the geometry of the Geohash 6gyf4bf
... Comparing results of ISEA and Albers equal-area projection.
test1 The area of the transformed boxes (rectangles of the Geohashes
6gyf4bf
and6gyf4bg
). Expected near same box areas.test2 The distance between box centers.
In the test1 of areas, the expected is ~0.0001% or less in area difference when comparing with PostGIS spheroid calculation with WGS84. Test2 is to check distance behavior in both projections.
SELECT geohash,
area1,
st_area(box1_geom_albers) area1_albers,
st_area(box1_geom_isea) area1_isea,
area2,
st_area(box2_geom_albers) area2_albers,
st_area(box2_geom_isea) area2_isea,
d,
st_distance(pt1_geom_albers, pt2_geom_albers) as d_albers,
st_distance(pt1_geom_isea, pt2_geom_isea) as d_isea
FROM (
SELECT
st_geohash(pt1_geom,8) as geohash, -- 6gyf4bf1
st_area(box1_geom,true) as area1,
st_area(box2_geom,true) as area2,
st_transform(pt1_geom,952019) pt1_geom_albers,
st_transform(pt2_geom,952019) pt2_geom_albers,
st_transform(box1_geom,952019) box1_geom_albers,
st_transform(box2_geom,952019) box2_geom_albers,
st_transform(pt1_geom,isea_proj) pt1_geom_isea,
st_transform(pt2_geom,isea_proj) pt2_geom_isea,
st_transform(box1_geom,isea_proj) box1_geom_isea,
st_transform(box2_geom,isea_proj) box2_geom_isea,
st_distance(pt1_geom, pt2_geom, true) d
FROM (
SELECT '+proj=isea', -- +resolution=1.0
ST_SetSRID(ST_GeomFromGeoHash('6gyf4bf'), 4326),
ST_SetSRID(ST_GeomFromGeoHash('6gyf4bg'), 4326),
ST_SetSRID( ST_Point( -46.633889, -23.550278), 4326), -- landmark
ST_SetSRID( ST_Point( -46.632156, -23.549881), 4326) -- centroid of 6gyf4bg
) t1(isea_proj,box1_geom, box2_geom, pt1_geom, pt2_geom)
) t2;
Results:
area1 | area1_albers | area1_isea | area2 | area2_albers | area2_isea |
---|---|---|---|---|---|
21326.147181987762 | 21326.14718184221 | 21424.010447963992 | 21326.147181987762 | 21326.14718169578 | 21424.01044831646 |
d | d_albers | d_isea |
---|---|---|
182.32446429 | 183.18969403271427 | 191.02939743271384 |
Area Albers difference: 0.000000145552 = abs(21326.1472 - 21326.14719); so 0% of 21326.
Area ISEA difference: 97.863265976230 = abs(21326.1472 - 21424.01045); so ~0.5% of 21326.
Distance Albers difference: ~0.47% = 100*abs(182.32446429-183.18969403271427)/182.32446429
Distance ISEA difference: ~4.78% = 100*abs(182.32446429-191.02939743271384)/182.32446429
So, ISEA area error is 10^7 times bigger, and distance error ~10 ... Something wrong in ISEA transform.
SRIDs on use case:
INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, proj4text) VALUES
( -- Brazilian Albers of 2019, SRID:
952019, 'BR:IBGE', 52019,
'+proj=aea +lat_0=-12 +lon_0=-54 +lat_1=-2 +lat_2=-22 +x_0=5000000 +y_0=10000000 +ellps=WGS84 +units=m +no_defs'),
( -- ISEA:
953000, 'INT:ISEA', 953000, '+proj=isea')
ON CONFLICT DO NOTHING;