marxanweb / general

Issues tracker, installers, registry, test data and example developer apps for Marxan Web
European Union Public License 1.2
2 stars 2 forks source link

Gap analysis really slow with the Allen Coral dataset on the beta machine #181

Closed andrewcottam closed 4 years ago

andrewcottam commented 4 years ago

SELECT * FROM marxan.gap_analysis('pu_ton_marine_hexagon_50',ARRAY[2314542,2314550,3487663,3487684,3487705,3487726,3487747,3487774,3487795,3487816,3487841,3487904,3488304,3488357,3488378,3488449,3488470,3488491,3488530,3488551,3488572,3488593,3488614,3488635,3488660,3488681,3488702,3488723,3488746,3488774,3488797,3488820,3488841,3489021,3489046,3489067,3489136,3489157,3489179,3489261,3489290,3490147,3490241,3490262,3490287,3490310,3490375,3490412,3490433,3490807,3490845,3490885,3490908,3490929,3491208,3491271,3491303,3491328,3491349,3491370,3491391,3491416,3491437,3491472,3491499,3491520,3491541,3491566,3491587,3491608,3491629,3491884,3491905,3491926,3491947,3491968,3491989,63407942,63408405,63408475,63767166])

andrewcottam commented 4 years ago

Here is the log:

DEBUG:  Country geometry: MULTIPOLYGON(((-179.088248833 -24.381958719,-178. (2020-03-10 11:12:25.501743+00)
DEBUG:  Using existing dissolved protected areas featureclass: wdpa_272_dissolved
DEBUG:  Dissolved protected area geometry: MULTIPOLYGON(((-179.115414739 -23.9141403799999,- (2020-03-10 11:12:25.644869+00)
DEBUG:  Creating the results in ga_272
DEBUG:  drop auto-cascades to type ga_272
DEBUG:  drop auto-cascades to type ga_272[]
DEBUG:  drop auto-cascades to toast table pg_toast_temp_5.pg_toast_3507016
DEBUG:  drop auto-cascades to index pg_toast_temp_5.pg_toast_3507016_index
DEBUG:  drop auto-cascades to type pg_toast_temp_5.pg_toast_3507016
DEBUG:  building index "pg_toast_3507022_index" on table "pg_toast_3507022"
DEBUG:   Getting the gap analysis for feature: Sandy bottom (2020-03-10 11:12:25.668037+00)
DEBUG:   Feature geometry: POLYGON((-175.180464127577 -21.0042848491224,-175 (2020-03-10 11:12:25.668501+00)
DEBUG:   Feature intersected with country geometry: POLYGON((-175.180464127577 -21.0042848491224,-175 (2020-03-10 11:12:25.668995+00)
...
DEBUG:   Feature intersected with protected areas: MULTIPOLYGON(((-175.128765511547 -21.160265675077 (2020-03-10 11:56:08.333643+00)
DEBUG:   Total feature area: 6109341.09262231
DEBUG:   Total protected feature area: 1814040.14640678
DEBUG:   Features processed: 81 out of 81

Successfully run. Total query runtime: 43 min 47 secs.
81 rows affected.
andrewcottam commented 4 years ago

I now only union data from GBIF (as the record may overlap) - all other features are left as is. Some other improvements to the gap_analysis function and now the above works in 3min 40s. Link here

Log now:

DEBUG:  Country geometry: MULTIPOLYGON(((-179.088248833 -24.381958719,-178. (2020-03-11 10:04:57.154744+00)
DEBUG:  Using existing dissolved protected areas featureclass: wdpa_272_dissolved
DEBUG:  Dissolved protected area geometry: MULTIPOLYGON(((-179.115414739 -23.9141403799999,- (2020-03-11 10:04:57.305122+00)
DEBUG:  Creating the results in ga_272
NOTICE:  table "ga_272" does not exist, skipping
DEBUG:  building index "pg_toast_3507706_index" on table "pg_toast_3507706"
DEBUG:  ---------------------------------------------------------
DEBUG:   Sandy bottom (2314550) (1/81)
DEBUG:   1 features
DEBUG:   Total area: 13595953.8156287m2
DEBUG:   Area within country: 13595953.8156287m2
DEBUG:   Area within protected areas: 0m2
DEBUG:   2020-03-11 10:04:57.324295+00
DEBUG:  ---------------------------------------------------------
DEBUG:   Volcano (63408475) (2/81)
DEBUG:   1 features
DEBUG:   Total area: 563271017.255086m2
DEBUG:   Area within country: 563271017.255086m2
DEBUG:   Area within protected areas: 65599954.4014568m2
DEBUG:   2020-03-11 10:04:57.345877+00
DEBUG:  ---------------------------------------------------------
...
DEBUG:   Outer Reef Flat | Coral (3491968) (81/81)
DEBUG:   14261 features
DEBUG:   Total area: 6109341.09262229m2
DEBUG:   Area within country: 6109341.09262229m2
DEBUG:   Area within protected areas: 1814040.14640677m2
DEBUG:   2020-03-11 10:08:35.670054+00

Successfully run. Total query runtime: 3 min 40 secs.
81 rows affected.