This file contains hidden or 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
#as seen on http://blog.cleverelephant.ca/2015/02/geotiff-compression-for-dummies.html | |
gdal_translate \ | |
-co COMPRESS=JPEG \ | |
-co PHOTOMETRIC=YCBCR \ | |
-co TILED=YES \ | |
5255C.tif 5255C_JPEG_YCBCR.tif | |
#create overviews | |
gdaladdo \ |
This file contains hidden or 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
#Import a directory of shapefiles into postgis as a geometry | |
#replace EPSG SRID, database, and username, and others if necessary | |
for f in *.shp; | |
do | |
shp2pgsql -s <EPSG SRID> -g geom $f main.${f%.*} | psql -h localhost -p 5432 -d <database> -U <username>; | |
done |
This file contains hidden or 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
cp -r -v -p <file> <dir> |
This file contains hidden or 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
for file in *.JPG ; do mv $file `echo $file | sed 's/\(.*\.\)JPG/\1jpg/'` ; done |
This file contains hidden or 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
# Name: arcsde-to-shp.py | |
# Description: Copies data from ArcSDE, converts it to shp file format and puts into destination folder | |
# Author: Garret Wais | |
import arcpy, os | |
from arcpy import env | |
arcpy.env.overwriteOutput=True | |
#set OS working directory | |
os.chdir("T:\\") |
This file contains hidden or 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
#The following will install Postgres, pgAdmin3, PostGIS, PGRouting, QGIS, and numix (for cooler icons) | |
#The ubuntugis launchpad repo provides all but pgrouting, pgAdmin and of course the numix icons, it provides similar versions of software - https://launchpad.net/~ubuntugis/+archive/ubuntu/ubuntugis-unstable | |
#Currently on Ubuntu 14.x the universal package sources offer Posgresql 9.3, and Postgis 2.1.2 so there is no need to add repositories for these alone, unless looking for the most up-to-date version. In which case going straight to the source will be your best bet. | |
#! /bin/bash (include if you want to turn this into a script) | |
#install postgis postgresql pgadmin3 from PGDG Repo **See alternative installation below if interested in a more up-to-date QGIS. | |
#source: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt |
This file contains hidden or 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
sudo apt-get install libxml2-dev libxslt1-dev python-dev | |
sudo pip install lxml | |
sudo pip install pykml | |
sudo apt-get update |
This file contains hidden or 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
import arcpy | |
mxd = arcpy.mapping.MapDocument("Current") # finds metadata on your current MXD | |
layerlist = arcpy.mapping.ListLayers(mxd) # grabs a list of layers with in your MXD | |
del layerlist[3] #If you need to delete an item in the layerlist list | |
expr = "'Northwest'" # Variables to run the calculatefield function. **notice the extra '' within ""... | |
field = "Zone" # | |
# Goes through list and assigns expr to the field you specified |
This file contains hidden or 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
#Compress tif with gdal | |
gdal_translate -of GTiff -co COMPRESS=DEFLATE -co TILED=NO image1.tif image1_compressed.tif | |
#copy all tifs to new location | |
for %I in (image1.tif image2.tif image3.tif image4.tif) do copy %I test\folder\ | |
#mosaic with gdal | |
gdalwarp --config GDAL_CACHEMAX 3000 -wm 3000 *.tif final_mosaic.tif |
This file contains hidden or 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
#Ubuntu 12.04 | |
#R 3.1.0 | |
terminal: | |
sudo apt-get install libdbd-mysql libmysqlclient-dev | |
wget http://cran.r-project.org/src/contrib/RMySQL_0.9-3.tar.gz | |
sudo R CMD INSTALL --configure-args='--with-mysql-inc=/usr/include/mysql' --configure-args='--with-mysql-lib=/usr/lib64/mysql' /home/user/Downloads/RMySQL_0.9-3.tar.gz |