2010-12-20

Calculus in 20 minutes

This guy is freakin amazing!





some older Grass GIS tutorial and ebook

I found two older documents about Grass GIS. Both seems quite valuable.
Legal one - Grass5 tutorial in homepage here
Illegal one in rapidshare - not mine, just found it - A Grass GIS Approach, 2nd edition

Ultracapacitors

What could be done with ultracapacitors or eletric double-layer capacitors?
from wiki:
They have applications as energy-storage devices used in vehicles, and for smaller applications like home solar energy systems where extremely fast charging is a valuable feature.


Pretty neat video about unusual ultracapacitor use

2010-12-19

Outsim Synthmaker v1.1.1.

It is very easy to build your own custom VSTi`s with this soft. It cames with good manual/tutorial where you can build a sample synth and also it has good wiki site.

I made sample synth and I was playing around it, and here I`ll build something more simple.

In the beginning I`m choosing midi input, and as I dont have any but keyboard, then I use it.

Next I`m adding two more modules - ASIO output (faster than usual ones, download here -> asio homepage) and midiToPoly. I enable PC Keyboard (it becomes red) and ASIO output (becomes blue) and connect Midi In to MidiToPoly.
I`m going to edit MidiToPoly module becouse I`ll use it as simple as I can. Double click on it and woala

There is a selector which selects frequency output type between normalized and usual one. Smaller red box shows playing classic note A and related frequencies. Larger red box shows primitives which I will delete, so I`ll directly connect Portamento frequency output to module output.
Now it becomes clear and simple.
And now - why did I delete that stuff? I want to add the sine wave oscilator primitive. And it needs normalized frequency. If it is so, then why should I use another converter to convert frequency to normalized or use that selector?
Almost finished - I`m adding stereo clip, which cuts mono values below 1 (because if it is above 1 it`s getting distorted)
And last modification - phase inverter using code. I`ll take one of StereoClip output and invert its phase using code textbox. Code textbox you can find under tab named "Other" or just search for "code"
And here it is. input has been taken and output is phase inverted source.

2010-12-18

Python and Qt4 Designer

On my windows machine I had a mouse related problem. Using VLC or QGIS I was unable to work with mouse - buttons didn`t respond on mouse clicks, yet still I was able to use keyboard shortcuts in VLC, but working in QGIS was completely unusable. I started look around where`s problem and I tried uninstall everything which I dont need and i`m not using and will not use. There it was - Microsoft Visual C++ and other related stuff. Uninstalling it, VLC and QGIS mouse clicks started to work normally.

The fact is, both - QGIS and VLC are Qt based and compiled programs, and Qt was somehow conflicting with Microsoft products.

I started to look around, what exactly is Qt.. and i found that it`s freeware framework, which is compatible with some programming languages, e.g. C++, Python.

I tried to search some tutorials, and the best what i found is in youtube.

Take a look.


2010-12-17

QGIS 1.6.0. released

New vesion of Quantum GIS, 1.6.0-Capiapo has been released last month, 17.11.2010
I didn`t try previous one, 1.5.0, but version 1.4.0 had some bugs, which seems to be corrected in the last one.
Adding WMS layers. There were some errors chosing more than one layer from server, but now it is repaired.
Ftools and defining Shapefile`s projection. Previously I got some python related errors, but from version 1.5.0 it works flawlesly.

Digitizing vectors gave headaches. If I have to digitize large area in large scale (or small scale.. which is more correctly?) - close enough, then i have to move base layer - it doesnt fit in screen. Moving layer is elementary - with mouse. But if I am digitizing in that time, how can it is possible to move layer? Dont have an extra mouse for layers... still i have shortcuts - keyboard arrows. This mouse thing WAS NOT working in v.1.5.0, so it IS working in v.1.6.0

I`m very proud that Grass support is almost fully implemented in QGIS. This gives huge additional boost for windows users. There`s no need to manually add qgis grass plugins, from v.1.5.0 it is included in one bundle. Install, next,next,finish and you get full qgis with grass support.

2010-12-16

combining two statistical parameters to get best suitability

R square value (coefficient of determinant) and root mean square error (rmse). These are typical parameters which shows, how two arrays are dependent from each other.

R square value shows tedency and is very easy calculated in MS Excel using command "=correl(array1[Ax:Ax+n];array2[Bx:Bx+n])^2" and it is calculated by formula
Equation 5. Equation. Coefficient of Determination. Uppercase R squared equals 1 minus summation under script lowercase i belongs to uppercase I open parentheses uppercase Y subscript lowercase i minus uppercase Y hat subscript lowercase i close parentheses raised to the second power divided by summation under script lowercase i belongs to uppercase I open parentheses uppercase Y subscript lowercase i minus uppercase Y bar close parentheses raised to the second power.

Root mean square error shows difference between two given data arrays. It is calculated by taking each data pair and getting their difference, and finally RMSE is equivalent to standart deviation of all these differences. Not too complicated as it seems.

R-squared is between 0 and 1. Usually RMSE is absolute and something positive (newertheless differences between data pairs still could be negative, but standart deviation always will be positive, even calculated from negative data - it is absolute deviation). But it is possible to get RMSE value relative, knowing each data array minimum and maximum values. Relative RMSE (RRMSE) = RMSE/maxx-minn

Now, both parameters are between 0 and 1.
Best suitability (BS) would be if R-squared = 1 (ascending) and RRMSE = 0 (descending)
BS = R^2-RMSE

Weights. Sometimes it is useful to give different weights to each of these statistical parameters. It`s simple - just multiply each coefficient with its weight.
I want that RMSE is twice hevier parameter than R^2.
BS = R^2 - RMSE*2

Sometimes it is useful to add some constante
BS = R^2 - RMSE + Const
but very rare.

2010-12-15

Historical maps

Hey!
Long time no see.
There`re few things waiting for writing them here.
But for now - some interesting historical Near East maps
==
----
Kish hegemony (2800-2500 BC)
Ebla hegemony (2500-2250 BC)
Lagash Hegemony (2454-2342 BC)
Mesopotamia
Uruk Lugalzagesi (2342-2318 BC)
Uruk Utukhengal (2123-2113 BC)
Ur empire (2112-2004 BC)
Isin empire (2017-1925 BC)
Babylon-Isin empire (1125-1103 BC)
Eshnunna empire (1830-1815 BC)
NeoBabylon empire (626-539 BC)
Akkad empire (2334-2154 BC)
Assirian empire
Antique (1813-1781 BC)
Middle (1365-1076 BC)
Late (935-609 BC)
Paleobabylonian (1792-1640 BC)
Karduniash empire (1570-1155 BC)
Mitanni empire (1500-1350 BC)
Damascus empire (842-797 BC)
Seleucid empire (305 - 63 BC)
Palmyr empire (260-272 AD)
Umayyad empire (661-750 AD)
Abbasid empire (750-945 AD)
Zengida empire (1127-1175 AD)
Jalayarid empire (1336-1432 AD)
----
==

Take a look Here

2010-08-09

One thing avoiding in GRASS GIS

Don`t use /GIS */ as data directory .
Avoid using capital letters
Avoid using GIS with whitespace as part of directory.
I had a problem with mask removing. Solved it, decapitalising and deleting whitespace.

2010-07-19

Grass scripting is eeeaseee

Actually it is soooo eeeasy scripting in grass. And it is also possible under windows. I tried Grass SVN6.5 and launched it with MSYS. It uses SH and it is possible to do everything from command line, in addition to execute bash scripts (from here). So i tried it. I made one sample bash script which includes three chained modules. so here it is
#!/bin/sh#
# This program is Free Software under the GNU GPL (>=v2).
if test "$GISBASE" = ""; then
echo "You must be in GRASS to run this program."exit
fi
CONTOURS=_contours
g.region res=25
v.surf.rst --o input=urbumi elev=$1 zcolumn=liimenis
r.contour input=$1 output=${1}${CONTOURS} step=$2

This script 1) sets the computational resolution to 25, 2) runs v.surf.rst data interpolator taking input data from "urbumi" vector file and values (zcolumn) from table "liimenis" and outputs it in name as command`s first argument , and 3) it creates a contour lines from the previously interpolated raster and it is using script`s second argument as the step for contourlines.The next thing is to create the specific script, which takes a certain data in respect to given argument and then interpolates a raster from these certain data.

2010-03-29

GRASS 6.4.0RC5, clean it up, give more info

g.remove and g.rename

r.what and r.info

Merging or combining rasters in GRASS 6.4.0RC5

It is possible to combine multiple raster files in one. It is useful for making masks. In short, we need to set the boundaries of working geographic region and then patch all maps together. Step by step:

Part I - g.region
1)Let`s set geographic region with g.region in command line and Run (GUI).
2)Choose maps which will define working region and only. Don`t choose anything else right now.
3)Run it.

Part II - r.patch
1)Launch r.patch in command line, run with GUI it.
2)Choose raster maps (input)
3)Give name for resultant raster map (output)
4)Run it.

Now you`ve got a new map in raster map list

GRASS 6.4.0RC5 and raster input

When the project and mapset region is created, it is easy to import raster and vector data, even if they are not defined on GRASS specified coordinate system.

File->Import Raster Map->Multiple Formats Using Gdal
and woila - here it is - r.in.gdal (or v.in.gdal, if importing vectors).
Otherwise (faster, by the way) importing raster using command line the same command - r.in.gdal and run in GUI.
If the raster (or vector) data has no specified coordinate system, you can
1) set it using ogr2ogr or
2) ignore this fact, and check Override projection (use location`s projection) under the Options tab.

2010-03-27

six million problem...

repetition est mater studiorum.

In Latvia we have historical problems with coordinate systems. Some times we need to work in one of them, some times in other.

This ir how to set coordinate systems from one to another

I have shp file in LKS coordinates. I need to make false north 60000000.

1)Let`s set the coordinate system in file we`re working to.

ogr2ogr -a_srs EPSG:3059 /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_LKS.shp /media/kratuve/gis_latvija/ARC_hydro/auce/lauks.shp


2)Let`s transfer coordinate system to WGS CoordSys.

ogr2ogr -t_srs EPSG:2100 /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_WGS.shp /media/kratuve/gis_latvija/ARC_hydro/auce/lauks_LKS.shp



For raster data we can use gdalwarp instead of ogr2ogr

Interesting artefacts about ogr2ogr and gdalwarp.
Using previous example with vector data (ogr2ogr), the data transformed correctly. But when I used the same parameters in gdalwarp, the data were transformed to the north, but they were incorrectly transformed. I tried hardcoded transformation.

1)First by setting known coordinate system for file
gdalwarp -s_srs "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.99960
0 +x_0=500000 +y_0=-6000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" /media/kratuve/gis_latvija/ARC_hydro/auce/"$inputFileName".tif /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_CH.tif

2)Second transform the coordinate system by adding (or in this case subtracting, because in previous step false northing [y0] is -6M) 60000000
gdalwarp -t_srs "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.99960
0 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_CH.tif /media/kratuve/gis_latvija/ARC_hydro/auce/"$outputFileName"_TR.tif


and it worked fine for me.



References:
http://www.gisnet.lv/gisnet/2007/03/datu-parprojicesana-ar-gdalogr/
http://www.gisnet.lv/gisnet/2007/04/sesu-miljonu-opera/

Additional info - bash script sample
http://paste.php.lv/eddccdff78d0d0f0a565561ce83bc6fb?lang=bash

2010-03-10

Reinstalled Ubuntu three times

Installed Debian..

Problems with fTools, as I mentioned before, on Ubuntu Karmic with QGIS 1.4.0 were "solved" (as I`m not very trustworthy to freeware)

Firstly I followed these instructions, installing and compiling ECW, MrSID, GDAL and GRASS seperately from QGIS, but still while making fTools "Dissolve", QGIS crashed. 

Launching QGIS, on terminal I got an error

*** glibc detected *** qgis: double free or corruption (fasttop): 0x00007ff38002b9a0 ***

and I found out, that this glibc error is solved by typing

export MALLOC_CHECK_=0

in console




2010-03-05

dissolve causes crash

Started messing around with vector data and I found, that qgis is frequently crashing when using vector geoprocessing tools.

Unnecessary problems are not wanted.

I found out that problems might be in python and SIP bindings. So it seems, that i should upgrade SIP and PyQt4 and then recompyle QGIS from source...
that`s sux. truly sux.

Ubuntu & VPN

Gotta problems trying to launch VPN in Karmic. Under Network Connections I was unable to add VPN connection. All I needed were
sudo apt-get install network-manager-pptp /
network-manager-vpnc network-manager-openvpn
and after that restarting network modules using
sudo /etc/init.d/networking restart
restart network-manager

I`m wondering, why these packages aren`t included in Karmic by default?

QGIS, basic GIS software and Karmic (Ubuntu 9.10)

I started installing QGIS based on written instructions here. But I`ve got some error-
package qgis is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source. E: Package qgi has no installation cadidate.
Messing around in google i found the way, how to correctly install qgis on Karmic.
Copied from ubuntugeek.com
----

First you need to open the terminal and run the following command

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable/

Update the source list

sudo apt-get update

Install qgis using the following command

sudo apt-get install qgis

---
Following the perrygeo.net instructions I tried to install other software, like GRASS and its plugins, mapserver-bin, gdal-bin, python-qt4, python-sip4, but I got message in terminal that these packages are already installed (assuming they`re installed together with QGIS).
Of course. perrygeo.net article is written 3 years ago... no more wonderings.

But still i was able to install python-gdal, cgi-mapserver, python-mapscript, gmt (which includes gmt-coastline-data), r-recommended, gpsbabel,
But still (x2), I bet, it is very good place where to start. For true newbies, like me.

2010-03-04

long time no see.

I`m involved in some new projects dealing with groundwaters, GIS and modelling. I`ll try to give some updates here how the things are going, problems and possible solutions.
Groundwater. Freeware. Modelling. Nice pictures.
These are keywords or my work. I started with all of them together reading materials and finding out what kinda free software I can use.
The OS and software I`m on right now -
OS = Linux Ubuntu 9.10 (Karmic Koala).
Software. I`ll focus mainly on QuantumGIS, GRASS and R, following discussions with collegues in Uni. But for each of them there will be a seperate story and discussions.
Here we go.

2010-01-14

parsing web pages.

Long time ago I was thinking that I`d like to see National Geographic NGM "Your Shoot Daily Dozen" pictures not in the flash, but simple embedded in web pages. Mostly because at that time i was using some of these pictures in another blog, making picture selection by myself, and i needed hyperlinks. It is almost impossible to get picture hyperlinks from flash based web page, but I found that this flash script is taking picture localizations from xml file. And that`s it - all I need to do is to get contents and parse this xml, and finally build the webpage.

The source code you can find here

http://paste.php.lv/dad8d34469fb4558edabac62aa83dea7?lang=php