Skip to content

Instantly share code, notes, and snippets.

View TDahlberg's full-sized avatar

Tyler Dahlberg TDahlberg

  • Amsterdam, Netherlands
View GitHub Profile
@TDahlberg
TDahlberg / Landsat_Therm_to_LST.py
Last active July 9, 2020 01:49
Convert Landsat 5&7 Thermal band to LST using Python
#! /usr/bin/env python
#######################################
# GDALCalcNDVI.py
#
# A script using the GDAL Library to
# create a new image containing the LST
# of the original DN value from Landsat
# 5 or 7 imagery.
#
@TDahlberg
TDahlberg / postgis_workshop_cartodb.md
Last active August 29, 2015 14:13
Boundless Geo PostGIS workshop translated to CartoDB

#Boundless Geo Exercise 11 ##What neighborhood and borough is Atlantic Commons in? Solution:

SELECT name, boroname
FROM nyc_neighborhoods
WHERE ST_Intersects(
  the_geom,(SELECT the_geom FROM nyc_streets WHERE name = 'Atlantic Commons'))
@TDahlberg
TDahlberg / phl_schools.geojson
Created January 26, 2015 22:21
Philadelphia Schools
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TDahlberg
TDahlberg / readme.md
Last active August 29, 2015 14:17
DSM - Friday, March 20
@TDahlberg
TDahlberg / readme.md
Last active August 29, 2015 14:19
Add Google Streetview images to CartoDB points

#How to add Google Streetview images to CartoDB points ##Add points to CartoDB ##Run the following code in the SQL editor:

SELECT *, 
'http://maps.googleapis.com/maps/api/streetview?size=300x190&location='||
ST_Y((the_geom))||','||ST_X((the_geom))||'&sensor=false&fov=110' as image 
FROM tablename

##Set the infowindow popup as "image header" type, select "image" as the title field

@TDahlberg
TDahlberg / readme.md
Last active August 29, 2015 14:24
OpenTreeMap SQL Summaries

#Count Trees and display by wards descending

SELECT
COUNT(trees.gid) AS trees,
wards.gid AS ward_num
FROM edmonton_trees AS trees
JOIN edmonton_wards AS wards
ON ST_Intersects(trees.the_geom, wards.the_geom)
GROUP BY wards.gid 
ORDER BY trees DESC
@TDahlberg
TDahlberg / readme.md
Last active December 14, 2016 03:27
Getting Started with PostGIS

#What is PostGIS and why should I care? ###PostGRES An open-source relational database management system (RDBMS). ###PostGIS An extension for PostGRES databases that adds the ability to store spatial data, and special functions to query spatial data.

###Advantages Using a PostGIS-enabled PostGRES database to store spatial data allows you to:

  • Store massive amounts of data
  • Work on files concurrently without corrupting them
@TDahlberg
TDahlberg / queries.sql
Last active August 29, 2015 14:24
Queries for OTM Webinar
"Beautiful In the Fall"
SELECT * FROM tree_export WHERE plot__address_zip = 19103 AND species__fall_conspicuous = TRUE
"Count Trees Per Neighborhood"
SELECT
hoods.mapname,
hoods.the_geom_webmercator,
hoods.cartodb_id,
COUNT(trees.cartodb_id) AS tree_count
FROM tree_export AS trees
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@TDahlberg
TDahlberg / chf_datacleaning.ipynb
Created June 17, 2016 15:23
CHF Data Cleaning notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.