Skip to content

Instantly share code, notes, and snippets.

Yuri Astrakhan nyurik

Block or report user

Report or block nyurik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nyurik
nyurik / getmvt.sql
Created Oct 18, 2019
OpenMapTiles getmvt(z,x,y) function with empty tile detection
View getmvt.sql
CREATE OR REPLACE FUNCTION getmvt(zoom integer, x integer, y integer)
RETURNS bytea AS $$
SELECT STRING_AGG(mvtl, '') AS mvt FROM (
SELECT IsEmpty, count(*) OVER () AS LayerCount, mvtl FROM (
SELECT CASE zoom <= 8 WHEN TRUE THEN FALSE ELSE ST_WITHIN(ST_GeomFromText('POLYGON(
(0 4096,0 0,4096 0,4096 4096,0 4096))', 3857), ST_COLLECT(mvtgeometry)) END AS IsEmpty, ST_AsMVT(tile, 'water', 4096, 'mvtgeometry') as mvtl FROM (SELECT ST_AsMVTGeom(geometry, TileBBox(zoom, x, y), 4096, 4, true) AS mvtgeometry, class, intermittent FROM layer_water(TileBBox(zoom, x, y), zoom) WHERE ST_AsMVTGeom(geometry, TileBBox(zoom, x, y), 4096, 4, true) IS NOT NULL) AS tile HAVING COUNT(*) > 0
UNION ALL
SELECT FALSE AS IsEmpty, ST_AsMVT(tile, 'waterway', 4096, 'mvtgeometry') as mvtl FROM (SELECT ST_AsMVTGeom(geometry, TileBBox(zoom, x, y), 4096, 4, true) AS mvtgeometry, name, name_en, name_de, NULLIF(tags->'name:ar', '') AS "name:ar", NULLIF(tags->'name:az', '') AS "name:az", NULLIF(tags->'name:be', '') AS "name:be", NULLIF(t
View composer.local.json
{
"extra": {
"merge-plugin": {
"include": [
"extensions/Wikibase/composer.json",
"../settings.d/composer/*.json"
]
}
}
}
View OSM wiki tag cleanup.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
fixes['osmlinks'] = {
'regex': True,
'nocase': True,
'msg': {
# '_default': 'Param cleanup, remove obsolete lang parameters - template detects it automatically',
'_default': 'Tag template cleanup - format combinations, use proper {{Tag}} template with params, remove kl= and vl= (handled automatically)',
},
@nyurik
nyurik / kibana_vega_question_guide.md
Last active Nov 21, 2019
How to submit Kibana Vega question
View kibana_vega_question_guide.md

How to submit Kibana Vega question

It is usually very difficult to debug Vega questions without having your data. To make it easier, please follow these steps to include data with your graph when posting:

  • Reduce your data query to the smallest possible dataset, e.g. set the time range to 15 minutes. It will work as long as it is not empty and represents your data well enough.
  • Open Browser Debugger (for Chrome, right click and click Inspect)
  • Switch to the Console tab
  • Copy the right command, paste it in the console at the > symbol and hit enter (check the schema in your graph to see if you use Vega or Vega-Lite)
View keybase.md

Keybase proof

I hereby claim:

  • I am nyurik on github.
  • I am nyurik (https://keybase.io/nyurik) on keybase.
  • I have a public key ASA_DNz0UNVjjeDMAIOHOLYL2y2ybFNWIMgB9dkX5A5j3Qo

To claim this, I am signing this object:

View rotating_world_map_random_data.hjson
{
$schema: https://vega.github.io/schema/vega/v3.json
padding: 10
config: {
kibana: {tooltips: false}
}
signals: [
{
name: rotation
value: 65
@nyurik
nyurik / rotating_world_map.hjson
Created Nov 13, 2018
Kibana rotating cloropleth world map
View rotating_world_map.hjson
{
$schema: https://vega.github.io/schema/vega/v3.json
padding: 10
config: {
kibana: {tooltips: false}
}
signals: [
{
name: rotation
value: 65
@nyurik
nyurik / vega_img.json
Created Jul 10, 2018
vega with conditional image (centered and stretched to the largest size preserving aspect ration)
View vega_img.json
{
"$schema": "https://vega.github.io/schema/vega/v4.json",
"width": 200,
"height": 200,
"padding": 5,
"marks": [
{
"type": "image",
"encode": {
"enter": {
View kibana Vega airports example.hjson
{
$schema: https://vega.github.io/schema/vega/v3.0.json
config: {
kibana: {type: "map", latitude: 25, longitude: -70, zoom: 3}
}
data: [
{
name: table
url: {
index: kibana_sample_data_flights
View multiline vega graph with filters.hjson
{
$schema: https://vega.github.io/schema/vega/v3.json
data: [
{
name: esdata
url: {
%context%: true
%timefield%: @timestamp
index: logstash-*
body: {
You can’t perform that action at this time.