2011-05-25

Since QGIS has simple and poverful GRASS GIS implementation, I found that more often I`m using this Grass version, not standalone Grass GIS.
There has been some needs for my friends doing very basic and simple things, but as it takes longer if someone don`t know QGIS and Grass well, I made some tutorials.

This one explains how to define coordinate system for project for correct distance and area measurements, and correctly add scalebar.

In this next video the DEM is loaded in Grass GIS database from QGIS and visualised through NVIZ. All under windows xp.





The next video shows how to georeference an image file. I`m using very dummy image file as example... ;)



The next video shows how to rasterize vector contour lines, how to interpolate rasterized contour lines and very basic mapcalc stuff - how to get difference between two different DEM`s.



This video shows a bit complicated raster analysis example. There is a dummy JPG raster file where each cell should contain values 0 (black) and 255 (white). But because it`s compressed and it`s JPG, there are cells between defined values. With simple mapcalc usage it`s possible to define - are these cells could be counted as black or white.
of course, it`s possible to do it just writing script in shell, but Grass allows create these scripts in very user friendly way.



But sometimes there are needs to manipulate with LIDAR data. And here LAStools are very handy. LAStools could be downloaded from here. But as they are command line tools, the easiest way is to write BAT`ch file (in windows).
So here is example - how to manage it.

2011-03-09

Cannot run commands from command prompt?

Playing around with GRASS and Python, accidentally I lost environment variable resulting that some commands, like ipconfig and ping, from command promt were not running and the error was called.
Windows system32 directory should be left as one of the PATH variables.
PATH=D:\GRASS-64\etc;D:\GRASS-64\etc\python;D:\GRASS-64\lib;D:\GRASS-64\bin;D:\GRASS-64\extralib;D:\GRASS-64\msys\bin;D:\Python27;D:\Windows\System32



2011-03-02

daily data

PHP mysql database code for wells. daily results for all wells.
Sometimes there`s a need for daily data, but in database there are records only about those days, when measurements were made.
In given example, it is possible to set the start and end days, and multiple measurement points a.k.a. wells.

2011-02-25

HeidiSQL

Very nice program to access remote SQL server.
Also, I`ve learned some neat things about MySql functions and extended use.
For example, here is some code
What does it do?
It`s looking for all similar months and returns an average value from all values on given month.
In the inner "select" I`m selecting all columns and I`m adding additional column, where the each month (meneshi) is added in each row using "where"
And then in the outer query I`m gruping values by newly created month column and calling an average function. It returns all average values for each group - month.
And lastly I`m ordering results by month. Easy as pie, actually.

Only thing I need to change is "ns" in third line from end of the script.
Next challenge would be to make average results for all ns.
select avg(lim), datums, meneshi
from
( select ns, lim, datums,
CASE
WHEN datums like '19__-01-__%' THEN '01'
WHEN datums like '19__-02-__%' THEN '02'
WHEN datums like '19__-03-__%' THEN '03'
WHEN datums like '19__-04-__%' THEN '04'
WHEN datums like '19__-05-__%' THEN '05'
WHEN datums like '19__-06-__%' THEN '06'
WHEN datums like '19__-07-__%' THEN '07'
WHEN datums like '19__-08-__%' THEN '08'
WHEN datums like '19__-09-__%' THEN '09'
WHEN datums like '19__-10-__%' THEN '10'
WHEN datums like '19__-11-__%' THEN '11'
WHEN datums like '19__-12-__%' THEN '12' END as meneshi
from hmetlimeni where ns=9664 ) as tble
group by meneshi
order by meneshi

2011-01-30

Python scripting under GRASS GIS

It was few months ago when I using GRASS last time. Since then there was few things that came in my mind about scripting. I discovered, that it was very easy building and launching bash scripts under windows environment, but I never tried Python.
Today, just accidentally, I was starting to think about it again, and discover, that it is not as easy as bashing, but very close.
The first thing was - install Python. In my case I was using Python 2.7.
The second - to set neccessary environmental variables.
And here comes where attention is needed.
In GRASS GIS homepage there are some samples using environmental variables, but it is possible, that user`s machine/computer is differentely configured.

So, here they are:


GISBASE= C:\GRASS-64
GISRC= C:\Documents and Settings\user\.grassrc6
LD_LIBRARY_PATH= C:\GRASS-64\lib
PATH= C:\GRASS-64\etc;C:\GRASS-64\etc\python;C:\GRASS-64\lib;C:\GRASS-64\bin;C:\GRASS-64\extralib;C:\GRASS-64\msys\bin;C:\Python26;
PYTHONLIB= C:\Python26
PYTHONPATH= C:\GRASS-64\etc\python
GRASS_SH= C:\GRASS-64\msys\bin\sh.exe


1st - Drive letter. In my case it`s D:\
2nd - user. Usually it is the name of user.
3rd - Where the GRASS is stored
4th - Where the Python is stored
5th - What version of Python is used.

That`s it.

2011-01-19

Getting categories out of blogspot/blogger feeds

Previous post about coding was about syndicating images in PicasaWeb with JonDesign`s Javascript gallery which uses mootools. Next task was mixing blogspot/blogger feeds in standalone web page. And again using easyXML in PHP5 it is easy as pie. In this script the interesting part is learning what the "child" is. If there is one big main structure, where similar smaller structures are built in, then these structures are like children to this main one. And in blogspot/blogger feeds there are possible to get tags or categories for each post. Additionaly, the term of the category is as attribute name inside the feed`s tag. It`s necessary to use attributes()->term, where term is attribute which has different possible names. And as these attributes could be more than one in each post or entry, then there it is where child is born. A new, child simpleXML object is created within this entry, and, correctly parsing, it is possible to get multiple items in each post. "foreach" entry categories loop inside of "foreach" entries loop.
And here is code to see it how it looks like and another DEMO link how it works.

Thus it is possible to get new blogspot/blogger feeds which are based on given tag/category, when building the hyperlink just add "/-/$category_name" in the end of blogger/blogspot full feeds link.

by the way the full blogger/blogspot feeds link is
"http://blogspotuser.blogspot.com/feeds/posts/default"
And modified link should look like

http://blogspotuser.blogspot.com/feeds/posts/default/-/category