Skip to content

Instantly share code, notes, and snippets.

View svershin's full-sized avatar

Sergey Vershinin svershin

View GitHub Profile
@svershin
svershin / poly2radius.py
Last active August 29, 2015 14:00
DataSift CSDL geo_polygon to geo_radius converter
# DataSift CSDL polygon to radius filter converter by Sergey Vershinin (https://gist.github.com/svershin)
# Takes a CSDL file that has some geo_polygon filters and converts them
# to centroids with an appropriate radius, commenting out the old geo_polygon statements
# *** NOTE: The script expects to have the 'twitter.geo geo_polygon "..."' statement on its own line
# *** BUG ALERT: Have not tested with scripts that have 'GEO_POLYGON' in upper case
import math
import string