Skip to content

Instantly share code, notes, and snippets.

View timlinux's full-sized avatar

Tim Sutton timlinux

View GitHub Profile
@timlinux
timlinux / inasafe-3.2-if-changes.md
Created September 9, 2015 11:25
inasafe-3.2-if-changes.md
Changed New Old
N earthquake/earthquake_building earthquake/earthquake_building
N earthquake/itb_earthquake_fatality_model earthquake/itb_earthquake_fatality_model
N earthquake/pager_earthquake_fatality_model earthquake/pager_earthquake_fatality_model
N generic/classified_raster_population generic/classified_raster_population
N generic/classified_polygon_population generic/classified_polygon_population
N generic/continuous_hazard_population generic/continuous_hazard_population
N generic/classified_polygon_building generic/classified_polygon_building
N generic/classified_raster_building generic/classified_raster_building
Native Windows:
lassort -i c:\Users\inasafe\Desktop\tandale1_densified_point_cloud.las -rescale 0.01 0.01 0.01 -olaz
lasground -i c:\Users\inasafe\Desktop\tandale1_densified_point_cloud_1.laz -city -ultra_fine -odix _g -olaz
# DTM
las2dem -i c:\Users\inasafe\Desktop\tandale1_densified_point_cloud_1_g.laz -keep_class 2 -thin_with_grid 0.125 -extra_pass -step 0.5 -ocut 2 -odix _dtm -obil
# DSM
las2dem -i c:\Users\inasafe\Desktop\tandale1_densified_point_cloud_1_g.laz -thin_with_grid 0.125 -extra_pass -step 0.5 -ocut 2 -odix _dsm -obil
timlinux@kartoza4:/home/realtime/inasafe-django/deployment> make staging-run
------------------------------------------------------------------
Building in staging mode
------------------------------------------------------------------
db uses an image, skipping
smtp uses an image, skipping
devdb uses an image, skipping
Building devuwsgi...
Step 0 : FROM kartoza/django-base
@timlinux
timlinux / gist:a57797a6650b10e1dd12
Created April 13, 2015 10:03
How to know the ide of the current impact function in InaSAFE
from PyQt4.QtGui import QDockWidget
app = iface.mainWindow()
dock = app.findChild(QDockWidget, 'DockBase')
dock.get_function_id()
'VolcanoPolygonPopulationFunction'
@timlinux
timlinux / pdf_generator.py
Last active March 20, 2022 20:11
Generate a QGIS map PDF using python
# coding=utf-8
# A simple demonstration of to generate a PDF using a QGIS project
# and a QGIS layout template.
#
# This code is public domain, use if for any purpose you see fit.
# Tim Sutton 2015
import sys
from qgis.core import (
@timlinux
timlinux / gist:952be093068311232e74
Created February 24, 2015 20:47
Setup pyspatialite on fedora
sudo python setup.py build_ext --include-dirs=/usr/include/
cd /tmp/pip_build_root/pyspatialite/
sudo python setup.py build_ext --include-dirs=/usr/include/
sudo pip install --no-download pyspatialite --include-dirs=/usr/include
gFunctionHelpTexts.insert( "if", QCoreApplication::translate( "function_help", "<h3>if() function</h3>\n"
"Returns the second argument if expression is true otherwise the third argument.\n"
"<br>\n"
"This function takes three arguments.\n"
"<h4>Syntax</h4>\n"
"<code>if(expression, result_if_true, result_if_false)</code><br>\n"
"\n"
"<h4>Arguments</h4>\n"
"<code>expression</code> - any valid expression or value, regardless of type.\n"
"<code>result_if_true</code> - any valid expression or value, regardless of type.\n"
@timlinux
timlinux / gist:ecb9210490959aa2000a
Last active August 29, 2015 14:15
QGIS-Certification-Meeting-12Feb2014
15∶24
timlinux Hi all
gioman joined
pcav joined
yjacolin joined
alexbruy joined
15∶50
timlinux he everyone
hi
we will wait 10 more minutes
@timlinux
timlinux / test_text.py
Created February 11, 2015 08:00
Example unit test for inasafe issue #1159
from encodings.utf_8 import encode
__author__ = 'timlinux'
import unittest
from safe.messaging.item.text import PlainText
class TestText(unittest.TestCase):
def test_plain_text(self):
@timlinux
timlinux / raster_to_xyz.py
Last active February 1, 2016 12:17
Simple example of how to convert a QGIS raster layer to an XYZ ascii file
from PyQt4.QtGui import QProgressBar
from PyQt4.QtCore import Qt
l = iface.activeLayer()
w = l.width()
h = l.height()
p = l.dataProvider()
# layers are base 1 for block reader
b = p.block(1, p.extent(), w, h)
f = file('/tmp/test.xyz', 'w')
f.write('Longitude,Latitude,VI')