Skip to content

Instantly share code, notes, and snippets.

View trolleway's full-sized avatar
🎯
Python, PostGIS, PostgreSQL, GIS

Artem Svetlov trolleway

🎯
Python, PostGIS, PostgreSQL, GIS
View GitHub Profile

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

@trolleway
trolleway / Ivanovo tram.geojson
Created April 10, 2014 09:19
Ivanovo tram lines geometry
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trolleway
trolleway / Architecture_objects.geojson
Last active June 2, 2016 18:59
Points of intresting buildings of brickstyle, avant-garde style, modernism and other sovarch.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trolleway
trolleway / map.geojson
Last active August 29, 2015 14:06
Карта реконструкции МКЖД
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@trolleway
trolleway / gist:6017b3a23729afd9d8d3
Created February 27, 2015 08:56
Выгрузка границ стран из дампа планеты OSM
#!/bin/bash
#выгрузить границы из OSM
#выгрузка границ стран из дампа планеты
#osmosis --read-pbf file=source/planet-latest.osm.pbf --tf accept-ways admin_level=2 --used-node --tf accept-relations admin_level=2 --write-pbf extracts/boundaries.osm.pbf
#./osmconvert source/planet-latest.osm.pbf -o=source/planet-latest.o5m
echo "Start step 1"
#time ./osmfilter32 source/planet-latest.o5m --keep= --keep-relations="admin_level=2" --out-o5m >extracts/admin_level2.o5m
@trolleway
trolleway / photo2blog styles
Last active October 11, 2015 22:19
photo2blog styles
-- первая версия, не помню что тут
(<a href="%(comments)s"><img src="%(source_ml)s" width="%(width_ml)s" height="%(height_ml)s" alt="%(title)s" border="0"></a>){1,1}
<lj-cut text="+NumPhotosInsideCut">
(<div style="background-color:lightgray; margin: 2em 0em"> <div style="font-weight: bold; color:black; font-family:monospace">%(title)s</div> %(description)s
<a href="%(comments)s"><img src="%(source_l)s" width="%(width_l)s" height="%(height_l)s" alt="%(title)s" border="0"></a>
<div class="Exif" style="font-size:80%"><span style="color:#EA1D2C">EXIF</span> %(Exif_exposure)s sec, f/%(Exif_aperture)s, %(Exif_focal_length)s, ISO %(Exif_ISO)s, %(Exif_date_time)s, %(Exif_model)s, %(Exif_lens)s</div>
</div>
){1,Last}</lj-cut>
@trolleway
trolleway / transphoto_imagemagick.markdown
Last active August 3, 2016 20:24
Обработка фото для transphoto.ru в ImageMagick®

Ресайз, шарперинг и сохранение в jpg всех фото в папке для transphoto.ru

mkdir output
mogrify -path output -resize 1143x857^> -unsharp 0x1 -quality 92 -format jpg *.jpg  #Загрузка нового фото
mogrify -path output -resize 1500x1000^> -unsharp 0x1 -quality 92 -format jpg *.jpg #Загрузка через восстановление

Ресайз, шарперинг и сохранение в jpg всех фото в папке для domofoto.ru C unsharp не берут

#ffmpeg -i "G:\PHOTO\_0\Olympus\2015-05-27\DSCN9178.MOV" -f image2 -vcodec mjpeg -qscale 1 -r 5 frames/output_%05d.jpg"
import os
import sys
import datetime
import math
from datetime import timedelta
from datetime import date
from decimal import Decimal
--Запрос выдаёт пикетные отметки по одиночной линии из таблицы trolleybus, на которых находятся магазины (из таблицы prodykty). Работает с EPSG:32637 (для Москвы)
SELаECT
row_number() OVER (ORDER BY 1) AS i, produkty."@id",
produkty.geom,
round((ST_line_locate_point(trolleybus.geom,produkty.geom) * ST_Length(trolleybus.geom)/1000)::numeric ,1) AS pk,
COALESCE(produkty.name,produkty.operator,produkty."@id") AS name
FROM produkty, trolleybus
WHERE ST_Intersects(produkty.geom , ST_Buffer(trolleybus.geom,500))
ORDER BY pk
@trolleway
trolleway / orekhovo_zuevo_demolitions.geojson
Created October 18, 2015 00:14
Сносы домов в Орехово-Зуево
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.