Skip to content

Instantly share code, notes, and snippets.

View rbanick's full-sized avatar

Robert Banick rbanick

  • Arbol
  • Ciudad de México, México
View GitHub Profile
# Tips
Always index the color palette, this will save space by only exporting a single color for any given pixel.
Export to PDF and *then* export as a PNG for greater file compression
Set the file compression to maximum
Open in Photoshop and resave at a lower DPI
@rbanick
rbanick / Random typography tricks
Last active August 29, 2015 14:07
Random typography tricks
All learned at NACIS 2014...
# Printing
## Printing with CMYK -- make sure it prints 100% K and no CMY (for black text)
* Because printing the C, M and Y on top of each other will be slightly slightly off. Errors and fuzziness.
* Also reduces eating ink colors
* "Separation preview" -- > "Turn off black" will show rich black vs. non-rich black
* If printing in color keep it to a minimum of channels
@rbanick
rbanick / Red Cross Mapping Style
Created October 18, 2014 16:23
Red Cross Mapping Style
# Styles Needed
After some reflection, I think we need multiple base map styles. We have a number of different audiences and one map can't possibly make all of them happy.
Our needs are such:
1. A "navigation" style that emphasizes landmarks, natural features, terrain, businesses and other features that are core to our business operations.
2. A "thematic" style that accomodates well multiple thematic layers. Should include terrain.
3. A "communications" basemap that we can use for external-facing products.
3. A flat, terrain-less dark style that we can use to change things up.
@rbanick
rbanick / Git resources
Created November 2, 2014 04:01
Git resources
Basic Git resources for staff members getting started (and old timers getting lost)
https://github.com/ian29/git-tutorial
http://gitimmersion.com/
http://wildlyinaccurate.com/a-hackers-guide-to-git?utm_content=buffer48386&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer

Bash script for batch GDAL processes. This example ogr2ogr converts from .shp to .geojson.

#!/bin/bash

for FILE in *.shp # cycles through all files in directory (case-sensitive!)
do
    echo "converting file: $FILE..."
    FILENEW=`echo $FILE | sed "s/.shp/_new.geojson/"` # replaces old filename
 ogr2ogr \
@rbanick
rbanick / Using VRT files to successfully convert CSV to points
Created November 2, 2014 11:25
Using VRT files for CSV to Points conversion.
Sometimes, for whatever reason, QGIS hates your CSV of point data and mangles it so it can't be converted to points. Sometimes, it gets worse and command line GDAL also messes things up. In these cases you can fall back on a .vrt
A .vrt is a really simple file that tells GDAL *exactly* where your lat/long columns are and how to render them (e.g. as point geometry). You can also use this for non-point geometry if you want to get fancy and have columns of polygon data (or a non-csv file type that holds them in another fashion).
A .vrt is basically formatted as below:
<OGRVRTDataSource>
<OGRVRTLayer name="[Filename]">
<SrcDataSource>[Filename].csv</SrcDataSource>
<GeometryType>wkbPoint</GeometryType>
@rbanick
rbanick / Fixing Postgres Links
Last active August 29, 2015 14:11
Fixing Postgres: Useful Links
@rbanick
rbanick / Creating Hillshades in QGIS
Last active January 22, 2018 22:23
Creating Hillshades in QGIS
QGIS Hillshades are not hard, but they're often a little screwy. That's because units of measurement for elevation and x/y are often different. So, for instance, your DEM may be projected in WGS84 and hence have decimal degree units. But the DEM elevation units are often in meters. You need to account for this in the "scale" setting of QGIS.
The basic rule of thumb is this:
If everything is in meters, use scale factor 1.0 (default).
If x/y is in degree and z in meters, use scale factor 111120.
If x/y degree and z is feet, use scale factor 370400.
So, in QGIS 2.6, go to Raster --> Analysis --> DEM (Terrain Modules)
Load up your data, name the new file, and leave all the settings the same EXCEPT for scale. In most cases (SRTM data) you'll then rename scale to 111120.
Someone foolishly used a file geodatabase? No problem. Get that data out at GDB Flee: https://gdbflee-mweisman.rhcloud.com/
@rbanick
rbanick / SoS_Charts.md
Created March 25, 2015 00:27
SoS Charts Instructions

Formatting the SoS Charts

Background

Make sure you have installed Helvetica Neue.

Tableau