This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Function: gkdb.repairgeom(geometry) | |
-- DROP FUNCTION gkdb.repairgeom(geometry); | |
CREATE OR REPLACE FUNCTION gkdb.repairgeom(polygon geometry) | |
RETURNS geometry AS | |
$BODY$ | |
DECLARE | |
linework geometry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION osm.split_polygon(polygon geometry, level integer) | |
RETURNS SETOF geometry AS | |
$BODY$ | |
DECLARE | |
num_points int; | |
mid double precision; | |
envelope geometry; | |
b1 geometry; | |
b2 geometry; | |
geom1 geometry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- source is in 4326 | |
drop table osm.land_polygons_3006; | |
create table osm.land_polygons_3006 (gid serial primary key, geom geometry(Polygon,3006)); | |
with transformed_subset1 as ( | |
select ST_Transform(ST_ClipByBox2D(geom, ST_MakeEnvelope(0, 40, 50, 75, 4326)), 3006) as geom from osm.land_polygons | |
), subset2 as ( | |
select ST_ClipByBox2D(geom, ST_MakeEnvelope(-350000, 5600000, 1870000, 7980000, 3006)) as geom from transformed_subset1 where ST_IsEmpty(geom) is false | |
) | |
insert into osm.land_polygons_3006 (geom) select (ST_Dump(ST_SubDivide(geom, 1000))).geom from subset2 where ST_IsEmpty(geom) is false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
<fontconfig> | |
<match target="font"> | |
<edit mode="assign" name="rgba"> | |
<const>rgb</const> | |
</edit> | |
</match> | |
<match target="font"> | |
<edit mode="assign" name="hinting"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ((delta & 7) > 4) rightOf else leftOf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait POf2[Bi[_, _]] { | |
def unapply[A, B](x: Bi[A, B]): Option[(A, B)] | |
} | |
implicit val TuplePOf2: POf2[Tuple2] = new POf2[Tuple2] { | |
def unapply[A, B](x: (A, B)) = Some(x) | |
} | |
(1, 4) match { case TuplePOf2(a, b) => a + b } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// cannot compile because cannot override mutable variable | |
// purpose of this pattern is to reuse logic from Base in Sub that works with BaseElements while Sub contains logic that works with SubElements | |
// not allowing override of vals has valid reasons so I'm looking for other options on how to design this | |
class BaseElement { | |
def foo() { println("I like foo") } | |
} | |
class SubElement extends BaseElement { | |
def bar() { println("I like bar") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseElement { | |
def foo() { println("I like foo") } | |
} | |
class SubElement extends BaseElement { | |
def bar() { println("I like bar") } | |
} | |
trait Base[T <: BaseElement] { | |
var map = Map[Int, T]() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val a = Vector.fill(64){true} | |
val b = Vector.fill(64){false} | |
val c = b.updated(10, true) | |
a zip c foreach { case (ae, ce) => if (ce) ae = false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function consolidateImageWMSLayers (layers) { | |
let i, j | |
const layersProcessed = [] // need to record processed layers to only process once | |
const layersToConsolidate = [] // intended to contain arrays of layer that are to be consolidated | |
const otherIndices = [] // indices of unconsolidated layers, will be used when assembling new layers | |
const isImageWMS = layer => layer.type === 'Image' && layer.source.type === 'ImageWMS' | |
const isProcessed = layer => layersProcessed.indexOf(layer) !== -1 | |
const isCandidate = (l1, l2) => l1.source.url === l2.source.url && !(l1.metadata.unconsolidated === true || l2.metadata.unconsolidated === true) |
OlderNewer