Posts

Showing posts with the label Python

A RESTFul with Openshft, Python + Flask and AeroGear

As a new year's resolution I have  started to learn Python. So I have read an introduction to this programming language. Then as next step I have created a RESTful API app. I have found tons of documents but, however, it take a lot of time and effort...  The aim    Build a RESTFul API to store and retrive  data. It use  MongoDB and AeroGear to send a notification (when new object is stored).   Tools     openshift , as hosting platform.    Python +  Flask , to build the RESTFul API.      AeroGear used to push notification.  Notification     The notifications are send with AeroGear. So I have used one of the openshift gears to hosting this service.  I also  have built an Android App to receive the notification (using Android SDK , AeroGear library for Android and the Google Api to manage  push notifications). RESTFull API    To build the Fla...

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="" ...