Skip to main content

Posts

Showing posts from March, 2014

Load raster into QGis with a python script

This week I have started to study PyQGis[2], then I have tried to write a python script to load several raster into the QGis layer . My filenames contain date as a part of name, so, instead to load all files in the folder, I have built the file name as a join of two string, the path of the folder and  date (extracted from a fixed range -> 01-01-2006 to 01-31-2006). Then I have extracted the maximum and minimum value from this raster, and the value in some fixed point of a shape file. import datetime import time startdate = datetime.date(2006,1,1) enddate = datetime.date(2006,1,31) minValue=0 maxValue=0 #load my point myShapeFile = QgsVectorLayer("/myPath/stazioni.shp", \ "stazioni", "ogr") myPoint = myShapeFile.getFeatures() #iterate to load all raster for i in range((enddate-startdate).days + 1): currentdate = startdate + datetime.timedelta(days=i) tt=time.strftime("%m-%d", currentdate.timetuple()) fileName=""

My first plot with xkcd

  xkcd R package is a tool to enhance the R plot. Usually, I use ggplot2 to build my plot, but I wanted to create "more informal" plot so I found this library [2]. 1) Install the extrafont e xkcd and sysfonts packages (I have had some problem with update packages, so before I have run update.packages(checkBuilt = TRUE, ask = FALSE) And then install xkcd from R repository and extrafont from downloaded code. The sysfonts required to install free-type (sudo apt-get install freetype*)  2) Install fonts from http://simonsoftware.se/other/xkcd.ttf within the R console library(ggplot2) library(extrafont)  if(! "xkcd" %in% fonts()) { xkcdFontURL <- "http://simonsoftware.se/other/xkcd.ttf" download.file(xkcdFontURL,dest="xkcd.ttf") font_import(".")  ## because we downloaded to working directory loadfonts() } 3) Install ggplot (In R) library(ggplot2) library(xkcd) library(extrafont) library(lubridate) wind<- r

My Coursera Maps and the Geospatial Revolution Peer Assessment

The purpose of my work has been to understand how my neighbor spent theirs spare time during the summer. The sample has been composed to the twitter users that has published tweet in a range of 150km from my house. Only few alternatives has been exterminated. So it has been extracted the tweet contains four keywords (lake, MUSE, MART or climbing) and no other hypothesis or check has been made on the the text.