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
# Parses maps.stamen.com log files | |
# 99% of the code comes from http://pymotw.com/2/multiprocessing/mapreduce.html | |
# Another useful article can be found here, http://effbot.org/zone/wide-finder.htm | |
# Per file processing time could be improved with threads I imagine | |
# roughly 2k-3k files totaling ~ 150mb takes about 30min | |
""" | |
Usage: | |
1. Download log files from s3 into local dated directories with your weapon of choice. |
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
# In-memory Cassandra-ish thingy... useful for unit tests. Maybe useful for other | |
# stuff too? No support for SuperColumns, but that should be easy enough to add. | |
import bisect | |
import copy | |
from cassandra.ttypes import NotFoundException, Column, ColumnPath, ColumnOrSuperColumn | |
class SSTable(object): |
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 TYPE CDB_DensityGridPair AS ( | |
geom GEOMETRY, | |
val FLOAT | |
); | |
CREATE OR REPLACE FUNCTION CDB_DensityGrid(table_name TEXT, geom_name TEXT, dimension FLOAT) | |
RETURNS SETOF CDB_DensityGridPair AS $$ | |
DECLARE | |
BEGIN | |
RETURN QUERY | |
EXECUTE 'SELECT ST_Envelope(GEOMETRYFROMTEXT(''LINESTRING(''||(st_xmax(geom)+(seed/2))||'' ''||(st_ymax(geom)+(seed/2))||'', ''||(st_xmin(geom)-(seed/2))||'' ''||(st_ymin(geom)-(seed/2))||'')'',3857)) as geom, val FROM (SELECT '||dimension||' as seed, count(*)::float as val, |
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
diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp | |
index 6854903..abf1972 100644 | |
--- a/src/agg/process_point_symbolizer.cpp | |
+++ b/src/agg/process_point_symbolizer.cpp | |
@@ -40,8 +40,58 @@ | |
// boost | |
#include <boost/make_shared.hpp> | |
+#include <boost/utility.hpp> | |
+ |
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
/* I, Brandon Martin-Anderson, release this into the public domain or whatever. */ | |
BufferedReader reader; | |
double ll, bb, rr, tt; | |
float A = 1000.0; | |
GlobalMercator proj = new GlobalMercator(); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
L.CompactTileLayer = L.TileLayer.extend({ | |
getTileUrl: function(tilePoint) { | |
this._adjustTilePoint(tilePoint); | |
var col = String("000000" + tilePoint.x).slice(String(tilePoint.x).length), | |
row = String("000000" + tilePoint.y).slice(String(tilePoint.y).length), | |
zoom = this._getZoomForUrl(); | |
return this._url | |
.replace("{z}", zoom) | |
.replace("{x}", col.slice(0, 3) + "/" + col.slice(3, 6)) | |
.replace("{y}", row.slice(0, 3) + "/" + row.slice(3, 6)); |
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
al@zorak.tobert.org ~ $ sudo virsh dumpxml newsblur | |
<domain type='lxc'> | |
<name>newsblur</name> | |
<uuid>cf64daa0-9fd0-088f-2bf2-436f23c43e88</uuid> | |
<memory unit='KiB'>1048576</memory> | |
<currentMemory unit='KiB'>1048576</currentMemory> | |
<vcpu placement='static'>2</vcpu> | |
<os> | |
<type arch='x86_64'>exe</type> | |
<init>/sbin/init</init> |
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 st_split(polygon geometry,split_line geometry) RETURNS SETOF geometry AS | |
$$ | |
DECLARE | |
v_geometry geometry; | |
BEGIN | |
FOR v_geometry IN SELECT (ST_Dump(( | |
ST_Polygonize(ST_Union(ST_Boundary(polygon),split_line)) |
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
P900913="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs" | |
EXTENT="-180 -85.05112878 180 85.05112878" | |
ogr2ogr --config PG_USE_COPY YES --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config SHAPE_ENCODING WINDOWS-1252 -t_srs "$P900913" -lco ENCODING=UTF-8 -lco SRID=900913 -clipsrc $EXTENT -segmentize 1 -skipfailures -f PGDump /vsistdout/ ne_10m_populated_places.shp | pv | psql -d natural_earth -q |
OlderNewer