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
/* https://twitter.com/tkardi/status/1521366132371902465 */ | |
drop table if exists tc; | |
create table tc as | |
select gid, path, | |
st_lineinterpolatepoint( | |
st_scale( | |
st_rotate( | |
st_exteriorring( | |
st_buffer( |
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
echo 'Apskritys geometries (from geojson) to lt.adr_gra_apskritys' | |
ogr2ogr -f PostgreSQL "PG:host=localhost user=postgres dbname=postgres" -lco overwrite=yes -lco schema=lt -lco launder=yes -lco geometry_name=geometry -lco fid=oid -nln adr_gra_apskritys -a_srs epsg:3346 -t_srs epsg:3346 https://www.registrucentras.lt/aduomenys/?byla=adr_gra_apskritys.json -progress | |
echo 'Apskritys props (from csv) to lt.adr_apskritys' | |
ogr2ogr -f PostgreSQL "PG:host=localhost user=postgres dbname=postgres" -lco overwrite=yes -lco schema=lt -lco launder=yes -lco fid=oid -nln adr_apskritys https://www.registrucentras.lt/aduomenys/?byla=adr_apskritys.csv | |
echo 'Savivaldybės geometries (from geojson) to lt.adr_gra_savivaldybes' |
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
<!DOCTYPE html> | |
<html> | |
<!-- The following HTML page together with the accompanying | |
javascript is published under the Unlicense. | |
SPDX-License-Identifier: Unlicense | |
--> | |
<head> | |
<meta charset="utf-8"> | |
<title>Air traffic map</title> |
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
# Flask app to run the `proxy.py` script. | |
# Run it on the path where both of the files are saved with | |
# (on Linux, for other systems plese see | |
# http://flask.pocoo.org/docs/1.0/quickstart/#a-minimal-application) | |
# | |
# $ export FLASK_APP=flaskapp.py | |
# $ flask run | |
# | |
# This will make the API available at http://127.0.0.1:5000/flightradar | |
# |
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
/** Subdividing "emtpy" space by expanding polygons | |
* ----------------------------------------------- | |
* This is the code-companion that is used in | |
* https://tkardi.ee/writeup/post/2018/07/21/subdividing-space/ | |
* | |
* Input data includes shapefiles from the Estonian Land Board's homepage | |
* (downloaded May 2018): | |
* - Estonian third level administrative units (settlements) with coastline | |
* borders: "asustusüksus", available for download from | |
* https://geoportaal.maaamet.ee/docs/haldus_asustus/asustusyksus_shp.zip |
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
/** Calculate a polygon "mesh" with left/right side properties in PostGIS | |
* ---------------------------------------------------------------------- | |
* Based on Estonian third level administrative units data downloaded | |
* from the Estonian Land Board's homepage (May 2018) @ | |
* https://geoportaal.maaamet.ee/eng/Maps-and-Data/Administrative-and-Settlement-Division-p312.html | |
* Direct link to the shapefile - https://geoportaal.maaamet.ee/docs/haldus_asustus/asustusyksus_shp.zip | |
* | |
* The following SQL code is published under the Unlicense. | |
*/ |
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
import argparse | |
import requests | |
from PIL import Image | |
from io import BytesIO | |
URL = 'http://localhost:8080/geoserver/test/ows?' | |
params = { | |
'service':'wms', | |
'request':'getmap', |
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 array_format_as_range( | |
arr int[], step int default 1) | |
returns varchar | |
as | |
$$ | |
declare | |
l int=array_upper(arr,1); | |
hyphen varchar='-'; | |
comma varchar=', '; | |
prv int; |
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
import json | |
import os | |
import shutil | |
from time import time | |
# absolute path to gwc dir, e.g '/opt/geoserver/data/gwc' or 'c:/geoserver/data_dir/gwc' | |
TILEPATH = '<path_to_geoserver_gwc_dir>' | |
# All zoomfolders in os.path.join(TILPATH, TILELAYER) path that should be scanned, | |
ZOOMFOLDERS = [ |
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
import os | |
from lxml import etree | |
def iter_path(path, ext): | |
"""Returns an iterator over files on path with a certain fileextension.""" | |
for dirname, paths, files in os.walk(path): | |
for _file in files: | |
_fname, _ext = os.path.splitext(_file) | |
if _ext.lower() == '.%s' % ext.lower(): |
NewerOlder