Skip to content

Instantly share code, notes, and snippets.

@mojodna
Last active October 26, 2018 21:47
Show Gist options
  • Save mojodna/4930ba18ab3ba668a116a8914009daa6 to your computer and use it in GitHub Desktop.
Save mojodna/4930ba18ab3ba668a116a8914009daa6 to your computer and use it in GitHub Desktop.
ESACCI-LC Mid Latitude mask

Mid Latitude masking

First, apply the mid latitude mask as mask.

Next, add envelopes for each of the C-CAP sources as masks (otherwise chunky pixels sneak in, per mojodna/marblecutter-land-cover#6):

update land_cover set mask = ST_Union(mask, (select ST_Union(ST_Envelope(geom)) from land_cover where source='C-CAP')) where source='ESACCI-LC Mid Latitudes';

Then, update the footprint to exclude the mask (to ensure that appropriate sources are selected):

update land_cover set geom=ST_Multi(ST_Difference(geom, mask)) where source='ESACCI-LC Mid Latitudes';
Display the source blob
Display the rendered blob
Raw
{"type":"MultiPolygon","coordinates":[[[[-180,-67.543299213666],[-180,44.290672451193],[-169.651962151894,45.4404544343159],[-165.050433839479,45.9517353579175],[-150.498047162671,52.5797701494713],[-140.103485250666,57.3140807148669],[-129.083462816547,59.8860345450767],[-115.387842449445,59.2869208826761],[-111.561513059792,59.119538452911],[-106.067021444721,57.4473472576603],[-99.7272234273319,55.5178958785249],[-87.9745119305857,49.5048806941431],[-80.874480468944,48.9853661969498],[-76.7684381778742,48.684924078091],[-65.813522307557,52.6681210825084],[-63.7913224330521,52.937923172724],[-60.6307412996322,53.3596081934995],[-57.5362758701571,53.894902800627],[-54.6151567251492,54.4002111844938],[-39.9802318823587,52.9032202767701],[-20.0570270051785,55.1370657281012],[-19.0981561822126,55.2445770065075],[-17.579651066929,56.5135195879766],[-6.95011525994386,65.3961176582604],[2.36161563285389,67.7230864827644],[8.03441515657605,69.5602947766872],[11.1470438738678,70.5683591849916],[24.4672909064708,70.0222033903046],[31.2402213288475,68.2200913695413],[33.9211946488736,68.6010844031962],[42.2042017719395,69.7781822832942],[49.3917846299417,69.8641192165294],[56.5600926612933,69.9498256940573],[67.6429811767093,71.0383682961173],[69.1257258987264,71.1840009798396],[69.3093534770256,71.1831900914736],[96.5370256720743,71.0629543250298],[115.022479356043,68.9591895659376],[140.771603007645,67.186857259529],[149.169387438259,61.5808502439599],[154.901880084849,57.7540797119215],[154.113187219803,52.8738314086386],[153.406722245239,48.502390197181],[153.406722245239,48.502390197181],[153.406722245239,48.502390197181],[163.279908298668,47.3018440923039],[165.392082429501,47.0450108459869],[180,45.4956862551764],[180,-61.7467976288429],[165.614154013015,-60.0105748373102],[134.182483731019,-54.5441973969631],[112.354341784165,-50.3291079175705],[94.5512472885032,-46.8912689804772],[78.3027783739451,-46.044994557844],[68.3126355748373,-45.5246746203905],[57.3798806941432,-54.2708785249458],[34.9677331887202,-56.1841106290673],[-5.21014099783079,-51.5376898047723],[-36.0951735357918,-50.1710954446855],[-36.0951735357918,-50.1710954446855],[-36.0951735357918,-50.1710954446855],[-38.4656891373269,-51.0383572501252],[-47.3012472885032,-54.2708785249458],[-64.2470173535792,-60.2838937093276],[-73.7215817647471,-59.8719561262333],[-89.3923535791757,-59.1906182212581],[-109.755340343591,-58.0067236419317],[-112.897776572668,-57.8240238611714],[-122.606062906725,-59.361169197397],[-145.696041214751,-63.0170824295011],[-166.238528161731,-65.7275494572277],[-180,-67.543299213666]],[[145.205995,20.009551],[145.208628,20.009551],[145.239815,20.009551],[145.239815,20.016579],[145.239815,20.036579],[145.22516,20.036579],[145.205995,20.036579],[145.205995,20.029671],[145.205995,20.009551]],[[-168.153904,-14.550887],[-168.14219,-14.550887],[-168.14219,-14.533211],[-168.153904,-14.533211],[-168.153904,-14.550887]],[[-170.848824,-14.376172],[-170.543476,-14.376172],[-170.543476,-14.22763],[-170.848824,-14.22763],[-170.848824,-14.376172]],[[-169.689464,-14.195264],[-169.604353,-14.195264],[-169.604353,-14.153473],[-169.689464,-14.153473],[-169.689464,-14.195264]],[[-169.521039,-14.276821],[-169.415909,-14.276821],[-169.415909,-14.20781],[-169.521039,-14.20781],[-169.521039,-14.276821]],[[-171.092933,-11.066629],[-171.063246,-11.066629],[-171.063246,-11.046558],[-171.092933,-11.046558],[-171.092933,-11.066629]],[[144.615665,13.230814],[144.961879,13.230814],[144.961879,13.656004],[144.615665,13.656004],[144.615665,13.230814]],[[145.120791,14.109937],[145.291617,14.109937],[145.291617,14.201041],[145.120791,14.201041],[145.120791,14.109937]],[[145.536282,14.8395],[145.579994,14.8395],[145.579994,14.867426],[145.536282,14.867426],[145.536282,14.8395]],[[145.581675,14.921818],[145.674359,14.921818],[145.674359,15.10165],[145.581675,15.10165],[145.581675,14.921818]],[[145.688041,15.091068],[145.831969,15.091068],[145.831969,15.290653],[145.688041,15.290653],[145.688041,15.091068]],[[146.050453,16.004367],[146.065741,16.004367],[146.065741,16.028688],[146.050453,16.028688],[146.050453,16.004367]],[[145.631233,16.329986],[145.725157,16.329986],[145.725157,16.372026],[145.631233,16.372026],[145.631233,16.329986]],[[145.765272,16.690093],[145.79115,16.690093],[145.79115,16.718874],[145.765272,16.718874],[145.765272,16.690093]],[[145.830678,17.294844],[145.854177,17.294844],[145.854177,17.323645],[145.830678,17.323645],[145.830678,17.294844]],[[145.812498,17.577958],[145.854182,17.577958],[145.854182,17.624131],[145.812498,17.624131],[145.812498,17.577958]],[[-64.90548,17.673337],[-64.56268,17.673337],[-64.56268,17.790165],[-64.90548,17.790165],[-64.90548,17.673337]],[[145.706904,18.04359],[145.811582,18.04359],[145.811582,18.170613],[145.706904,18.170613],[145.706904,18.04359]],[[145.634386,18.723767],[145.701641,18.723767],[145.701641,18.814906],[145.634386,18.814906],[145.634386,18.723767]],[[-156.063761,18.908933],[-154.80467,18.908933],[-154.80467,20.270526],[-156.063761,20.270526],[-156.063761,18.908933]],[[145.385955,19.67435],[145.417844,19.67435],[145.417844,19.708096],[145.385955,19.708096],[145.385955,19.67435]],[[144.884851,20.535211],[144.903952,20.535211],[144.903952,20.554643],[144.884851,20.554643],[144.884851,20.535211]],[[-157.06774,20.726954],[-156.797618,20.726954],[-156.797618,20.933797],[-157.06774,20.933797],[-157.06774,20.726954]],[[-157.315497,21.038878],[-156.704062,21.038878],[-156.704062,21.228546],[-157.315497,21.228546],[-157.315497,21.038878]],[[-158.282495,21.252518],[-157.646929,21.252518],[-157.646929,21.712731],[-158.282495,21.712731],[-158.282495,21.252518]],[[-160.248065,21.776231],[-160.046137,21.776231],[-160.046137,22.029902],[-160.248065,22.029902],[-160.248065,21.776231]],[[-159.788179,21.865888],[-159.290738,21.865888],[-159.290738,22.236572],[-159.788179,22.236572],[-159.788179,21.865888]],[[-156.705598,20.497051],[-156.525409,20.497051],[-156.525409,20.574082],[-155.97402,20.574082],[-155.97402,21.032542],[-156.69906,21.032542],[-156.69906,20.608475],[-156.705598,20.608475],[-156.705598,20.497051]],[[-66.327399,17.911284],[-66.129542,17.911284],[-66.129542,17.921252],[-65.237688,17.921252],[-65.237688,18.521262],[-67.27663,18.521262],[-67.27663,17.921252],[-66.327399,17.921252],[-66.327399,17.911284]],[[-64.790964,18.374536],[-64.790964,18.416124],[-65.086138,18.416124],[-65.086138,18.273147],[-64.790964,18.273147],[-64.790964,18.295632],[-64.645757,18.295632],[-64.645757,18.374536],[-64.790964,18.374536]]]]}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment