Skip to content

Instantly share code, notes, and snippets.

@jqtrde
jqtrde / index.html
Last active August 29, 2015 14:08
ey gurl
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.3.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.3.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.3.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.3.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@jqtrde
jqtrde / _.md
Created January 19, 2015 22:24
color scales
@jqtrde
jqtrde / _.md
Created January 19, 2015 22:25
color scales
@jqtrde
jqtrde / index.html
Last active August 29, 2015 14:15 — forked from anonymous/index.html
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<style type='text/css'>
div {
cursor:pointer;
cursor:hand;
@jqtrde
jqtrde / vim-for-python.md
Created February 18, 2015 05:34
Vim as a Python IDE

Vim as a Python IDE

  • Why?
    • Pre-installed everywhere
    • Use directly in terminal
    • Modal commands
    • Fast
    • Community, and all that comes with that.
  • Basics
@jqtrde
jqtrde / load_shp_to_AWS
Last active August 29, 2015 14:16 — forked from glw/load_shp_to_AWS
shp2pgsql -s 4326 -d -g the_geom shapefilename.shp shapefilename |psql -U username --password -p 5432 -h reallylonghostnametoamazonaws.com dbname
```
SELECT *
FROM (SELECT the_geom FROM incidents WHERE incidents.major_category = 'Fire') as f, (SELECT geom FROM neighborhoods_wa WHERE neighborhoods_wa.name = 'Broadmoor') as n
WHERE ST_Within(f.the_geom, n.geom);
```
# https://www.mapbox.com/blog/processing-landsat-8/
task :landsat_2014 => :environment do
dirs = Dir["#{Rails.root.to_s}/db/initial/raster/*"].reject {|q| q =~ /tar\.gz/ }
dirs.each do |dir|
scene_id = dir.split("/")[-1]
[4,3,2].each do |band|
`gdalwarp -t_srs EPSG:3857 #{dir}/#{scene_id}_B#{band}.TIF #{dir}/#{scene_id}_B#{band}-projected.tif`
end
`convert -combine #{dir}/#{scene_id}_B{4,3,2}-projected.tif #{dir}/#{scene_id}_RGB-projected.tif && \
convert -channel B -gamma 0.925 -channel R -gamma 1.03 -channel RGB -sigmoidal-contrast 50x16% #{dir}/#{scene_id}_RGB-projected.tif #{dir}/#{scene_id}_RGB-projected-corrected.tif && \