From http://grass.osgeo.org/wiki/Compile_and_Install_Ubuntu First of all, do NOT install the following grass/ogr Ubuntu packages as they are often broken :gdal-bin libgdal1-dev. Instead, install grass/ogr from source code (recommended) : http://midyetavablog.blogspot.com/2009/11/compiling-gdal-on-ubuntu-karmic-910.html To build grass install the following packages in Ubuntu : sudo apt-get install build-essential flex bison libncurses5-dev zlib1g-dev \ libjpeg62-dev libgdal1-dev libtiff4-dev libgcc1 tcl8.5-dev tk8.5-dev \ gettext fftw3-dev libfreetype6-dev libavcodec-dev libavformat-dev libxmu-dev make python-dev \ swig libavutil-dev libavutil49 libgl1-mesa-dev libglu1-mesa-dev libcairo2-dev \ libblas-dev liblapack-dev libglw1-mesa-dev To build the wxphython GUI, install the following Ubuntu packages : sudo apt-get install libwxbase2.8-0 libwxbase2.8-dbg libwxbase2.8-dev \ libwxgtk2.8-0 libwxgtk2.8-dbg libwxgtk2.8-dev \ python-wxgtk2.8 wx2.8-doc wx2.8-examples \ wx2.8-headers wx2.8-i18n python-numpy We are ready to configure the system and start building : ./configure \ --with-tcltk-includes=/usr/include/tcl8.5 \ --with-wxwidgets=/usr/bin/wx-config \ --with-postgres-includes=/usr/include/postgresql --with-postgres=yes \ --with-cairo --with-blas --with-lapack --with-python \ --with-proj-share=/usr/share/proj make sudo make install I was not able to make work the following flags : --with-ffmpeg --with-ffmpeg-includes=/usr/include/libavcodec --with-glw
Nothing fancy. Just a scratchboard for Open Source Geospatial manipulations. Involves (although not limited to) Linux, R, gdal, Quantum GIS, Geoserver etc.
Tuesday, November 17, 2009
Ubuntu Karmic : Building the GRASS GIS and its wxpython source code
Tuesday, November 10, 2009
Compiling GDAL on Ubuntu Karmic 9.10
First, obtain the latest stable gdal sources from http://trac.osgeo.org/gdal/wiki/DownloadSource .
In my case, I used http://download.osgeo.org/gdal/gdal-1.6.3.tar.gz
Before compiling, I had to install the following Ubuntu packages :
sudo apt-get install libnetcdf4 libnetcdf-dev libpng-dev libtiff4-dev libcurl4-dev libtool python-gdal
The following commands
./configure
make
sudo make install
sudo ldconfig
This will install the binaries in /usr/local/bin and the libraries in /usr/local/lib
This default configuration will compile only a fraction of the formats supported. Feel free to add more components to your taste. After all, it's all FREE software!
In my case, I used http://download.osgeo.org/gdal/gdal-1.6.3.tar.gz
Before compiling, I had to install the following Ubuntu packages :
sudo apt-get install libnetcdf4 libnetcdf-dev libpng-dev libtiff4-dev libcurl4-dev libtool python-gdal
The following commands
./configure
make
sudo make install
sudo ldconfig
This will install the binaries in /usr/local/bin and the libraries in /usr/local/lib
This default configuration will compile only a fraction of the formats supported. Feel free to add more components to your taste. After all, it's all FREE software!
Wednesday, September 30, 2009
Bluetooth GPS in Linux with gpsd
I have the following no-name bluetooth-only gps device. When I plug it into the USB port of my computer for a recharge, it is seen as :
$lsusb
Bus 003 Device 011: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
I already have the bluetooth stack working on Ubuntu so I could make a bluetooth scan for it. The gadget presents itself as GT-750F :
$hcitool scan
Scanning ...
00:0B:0D:76:83:73 GT-750F
Following the instructions at http://gpsd.berlios.de/bt.html, I added the following section into /etc/bluetooth/rfcomm.conf :
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device 00:0B:0D:76:83:73;
# RFCOMM channel for the connection
channel 1;
# Description of the connection
comment "GPS GT-750F";
}
I then launched gpsd with the following command :
sudo gpsd -D 2 -N /dev/rfcomm0
and using xgps and gpsdrive, I saw that it al worked fine.
Magellan Explorist 600 in Linux with gpsd
First, you need to setup the GPS. To do so, within th GPS unit, go :
Menu-Advanced Features-Communications-NMEA Data Comm
and select "V2.1 GSA"
When the GPS is connected to the USB port, a Linux system message appears. To see it, withing Linux command line, type :
sudo tail -f /var/log/messages
Sep 30 15:32:01 sac-laptop kernel: [65151.544586] usb 3-4: USB disconnect, address 6
Sep 30 15:46:34 sac-laptop -- MARK --
Sep 30 16:02:26 sac-laptop kernel: [66976.703565] usb 3-4: new full speed USB device using ohci_hcd and address 7
Sep 30 16:02:26 sac-laptop kernel: [66976.949095] usb 3-4: configuration #1 chosen from 1 choice
Sep 30 16:02:26 sac-laptop kernel: [66976.971345] cdc_acm 3-4:1.0: ttyACM0: USB ACM device
You could then manually launch the gpsd daemon :
sudo gpsd -D 2 -N -n /dev/ttyACM0&
and test it using xgps (shipped with gpsd) or gpsdrive.
If everything is working for you, you can omit the debugging option (-D 2) and the -N option that allows the program to run in the background mode.
Menu-Advanced Features-Communications-NMEA Data Comm
and select "V2.1 GSA"
When the GPS is connected to the USB port, a Linux system message appears. To see it, withing Linux command line, type :
sudo tail -f /var/log/messages
Sep 30 15:32:01 sac-laptop kernel: [65151.544586] usb 3-4: USB disconnect, address 6
Sep 30 15:46:34 sac-laptop -- MARK --
Sep 30 16:02:26 sac-laptop kernel: [66976.703565] usb 3-4: new full speed USB device using ohci_hcd and address 7
Sep 30 16:02:26 sac-laptop kernel: [66976.949095] usb 3-4: configuration #1 chosen from 1 choice
Sep 30 16:02:26 sac-laptop kernel: [66976.971345] cdc_acm 3-4:1.0: ttyACM0: USB ACM device
You could then manually launch the gpsd daemon :
sudo gpsd -D 2 -N -n /dev/ttyACM0&
and test it using xgps (shipped with gpsd) or gpsdrive.
If everything is working for you, you can omit the debugging option (-D 2) and the -N option that allows the program to run in the background mode.
Sunday, September 6, 2009
Can't import into Zotero a BibTeX file exported from JabRef
Instead of importing the contents into Zotero, Firefox tries to Open/Save it itself. The fix was found in Zotero forums :
This seems to be related to the character/mime encoding of the BibTeX file. Zotero produces UTF-8 files & can import them without spawning a new window:
But the fix did not work for me. So in JabRef, I had to export the same file into RIS from format. The RIS file imported successfully into Zotero.
This seems to be related to the character/mime encoding of the BibTeX file. Zotero produces UTF-8 files & can import them without spawning a new window:
$ file Exported\ Items.bib
Exported Items.bib: Unicode text, UTF-8
$ file -i Exported\ Items.bib
Exported Items.bib: text/plain; charset=utf-8
But not so with ascii files:$ file broken.bib
broken.bib: BibTeX text file
$ file -i broken.bib
broken.bib: text/plain; charset=us-ascii
Changing the file to UTF-8 w/ BOM:$ uconv --add-signature broken.bib >fixed.bib && file fixed.bib
fixed.bib: Unicode text, UTF-8
$ file -i fixed.bib
fixed.bib: text/plain; charset=utf-8
leads to successful import (as does importing from the clipboard).But the fix did not work for me. So in JabRef, I had to export the same file into RIS from format. The RIS file imported successfully into Zotero.
Friday, September 4, 2009
How to recursively list and delete empty directories in linux?
To list empty directories below the current dir :
find ./ -type d -empty
to delete them :
find ./ -type d -empty -delete
find ./ -type d -empty
to delete them :
find ./ -type d -empty -delete
Friday, August 21, 2009
Sorting installed packages by size in ubuntu
(taken from snipt)
How to sort installed packages in Ubuntu with respect to the size (in kB) they occupy on disk :
How to sort installed packages in Ubuntu with respect to the size (in kB) they occupy on disk :
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k2 -n
Tuesday, August 4, 2009
How do I disable auto-bullets in OpenOffice?
Taken from the : help.com article
A ‘+’ or ‘*’ preceding any line automatically formats the following lines as bullets. To turn it off :
Tools -> Autocorrect… -> Options -> Apply Numbering Symbol
A ‘+’ or ‘*’ preceding any line automatically formats the following lines as bullets. To turn it off :
Tools -> Autocorrect… -> Options -> Apply Numbering Symbol
Sunday, June 14, 2009
Securing the apache2 web server with SSL in Linux
This was done in ubuntu 9.04 jaunty
First enable the mod-rewrite module of the apache2 web server :
cd /etc/apache2
cd mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load
Then add the pre-configured virtual host that will work over SSL
cd /etc/apache2
cd sites-enabled
sudo ln -s ../sites-available/default-ssl 000-default-ssl
To forward all not-SSL requests (port 80) to the SSL host, add the following lines in the virtual host for port 80 (on ubuntu, it is the file called sites-available/default) :
RewriteEngine On
RewriteRule ^(.*)$ https://myroundcubeserver.mydomain.com$1
First enable the mod-rewrite module of the apache2 web server :
cd /etc/apache2
cd mods-enabled
sudo ln -s ../mods-available/rewrite.load rewrite.load
Then add the pre-configured virtual host that will work over SSL
cd /etc/apache2
cd sites-enabled
sudo ln -s ../sites-available/default-ssl 000-default-ssl
To forward all not-SSL requests (port 80) to the SSL host, add the following lines in the virtual host for port 80 (on ubuntu, it is the file called sites-available/default) :
RewriteEngine On
RewriteRule ^(.*)$ https://myroundcubeserver.mydomain.com$1
Friday, June 5, 2009
MD5SUM for windows
To be able to compute/verify MD5 sums of files under Windows, use the free software called "digestIT 2004". Download it from http://www.colonywest.us/
Downloading free TerraSAR-X demo files from Linux
Use lftp :
lftp -p 990 -du infoterra,itd delivery.infoterra.de
lftp -p 990 -du infoterra,itd delivery.infoterra.de
Thursday, June 4, 2009
Converting a kmz file into shapefile format in R
ogr does not recognize the .kml file unzipped from the .kmz file :o(
$unzip infile.kmz
Archive: infile.kmz
inflating: doc.kml
$ ogrinfo doc.kml
FAILURE:
Unable to open datasource `gocek_revised_20090604_AC.kml' with the following drivers.
...
-> KML
...
so I use gpsbabel to convert the .kml file into gpx format :
gpsbabel -i kml -f doc.kml -o gpx -F doc.gpx
I then load the gpx file into Quantum GIS using the GPS plugin. Then I output the loaded layer into shapefile.
I am sure smarter ways to achieve this exist but that's what I could come up with this fast using OpenSource tools.
vive l'OpenSource!
$unzip infile.kmz
Archive: infile.kmz
inflating: doc.kml
$ ogrinfo doc.kml
FAILURE:
Unable to open datasource `gocek_revised_20090604_AC.kml' with the following drivers.
...
-> KML
...
so I use gpsbabel to convert the .kml file into gpx format :
gpsbabel -i kml -f doc.kml -o gpx -F doc.gpx
I then load the gpx file into Quantum GIS using the GPS plugin. Then I output the loaded layer into shapefile.
I am sure smarter ways to achieve this exist but that's what I could come up with this fast using OpenSource tools.
vive l'OpenSource!
Saturday, May 23, 2009
finding and removing certain files in Linux shell
To recursively search all the *.ogg files under the current dir (denoted by .) and delete them, in Linux shell, type:
find . -name \*.ogg -exec rm {} \;
find . -name \*.ogg -exec rm {} \;
Tuesday, May 12, 2009
Matching an empty string in a cellstring array in Matlab
Say you have the following cellstring array in Matlab :
a =
{'0.13'
'0.48'
'0.11'
'0.1'
''
''
'0.03'
'0.22'
'0.09'
'0.29'
'0.14'
'0.33'}
In order to match the cellstring array rows with empty strings, use :
regexp(a, '^\d')
or
cellfun('isempty', regexp(a, '^\d'))
Here we are taking advantage of the fact that we have all numeric strings. Anybody any idea on how to accomplish this if the non-empty strings were composed of letters?
a =
{'0.13'
'0.48'
'0.11'
'0.1'
''
''
'0.03'
'0.22'
'0.09'
'0.29'
'0.14'
'0.33'}
In order to match the cellstring array rows with empty strings, use :
regexp(a, '^\d')
or
cellfun('isempty', regexp(a, '^\d'))
Here we are taking advantage of the fact that we have all numeric strings. Anybody any idea on how to accomplish this if the non-empty strings were composed of letters?
Monday, April 27, 2009
Searching for keyword values in a text (configuration) file in R
Taken from :
https://stat.ethz.ch/pipermail/r-help/2006-September/113841.html
Question :
I would like to read values from an ASCII text file that contains information in the following format:
DEVICE = 'PC'
CPU_SPEED = '1999', '233'
...
How can I e.g. get R to read the 2nd value of CPU_SPEED?
Answer :
Read in data using readLines and replace
= with comma and delete all spaces.
Then reread using read.table and set the
rownames to column 1 removing column 1.
# test data
Lines0 <- "DEVICE = 'PC'
CPU_SPEED = '1999', '233'
"
# if reading from a file then
# replace next line with something like Lines <- readLines("myfile.dat")
Lines <- readLines(textConnection(Lines0))
Lines <- gsub("=", ",", Lines)
Lines <- gsub(" ", "", Lines)
DF <- read.table(textConnection(Lines), sep = ",", fill = TRUE,
colClasses = "character", header = FALSE)
rownames(DF) <- DF[,1]
DF <- DF[,-1]
DF["CPU_SPEED", 2]
https://stat.ethz.ch/pipermail/r-help/2006-September/113841.html
Question :
I would like to read values from an ASCII text file that contains information in the following format:
DEVICE = 'PC'
CPU_SPEED = '1999', '233'
...
How can I e.g. get R to read the 2nd value of CPU_SPEED?
Answer :
Read in data using readLines and replace
= with comma and delete all spaces.
Then reread using read.table and set the
rownames to column 1 removing column 1.
# test data
Lines0 <- "DEVICE = 'PC'
CPU_SPEED = '1999', '233'
"
# if reading from a file then
# replace next line with something like Lines <- readLines("myfile.dat")
Lines <- readLines(textConnection(Lines0))
Lines <- gsub("=", ",", Lines)
Lines <- gsub(" ", "", Lines)
DF <- read.table(textConnection(Lines), sep = ",", fill = TRUE,
colClasses = "character", header = FALSE)
rownames(DF) <- DF[,1]
DF <- DF[,-1]
DF["CPU_SPEED", 2]
Thursday, April 16, 2009
MySQL Command line
How do I import a MySQL dumpfile into my database?
From linux shell :
$mysql -u gocek_egroupware -p gocek_egroupware2_16 < gocek_egroupware_16_eski.sql
From linux shell :
$mysql -u gocek_egroupware -p gocek_egroupware2_16 < gocek_egroupware_16_eski.sql
Wednesday, April 15, 2009
Making animations in Linux with ffmpeg and meconde
This information is taken from http://electron.mit.edu/~gsteele/
To make an animation from the image files, you may use mencode or ffmepg. Here, we will use mencode. First, all the images need to be converted to .jpg format :
In linux shell, type the following code :
for f in *png ; do convert -quality 100 $f `basename $f png`jpg; done
Then use encoder to create an avi file.
mencoder "mf://*.jpg" -mf fps=5 -o ModisTerra_Gocek.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800
I wanted my animation to display slower but setting the frame rate less than 5fps confused vlc, my favorite open source movie player (http://videolan.org) :
[00000420] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
So I created the animation at 5 fps but reduced the playing speed from vlc.
It is also possible to view the animation with mplayer. Mplayer can even display a movie with a frame rate of 1 fps, no problems. One can adjust the move playing speed by pressing the [ and ] keys.
To make an animation from the image files, you may use mencode or ffmepg. Here, we will use mencode. First, all the images need to be converted to .jpg format :
In linux shell, type the following code :
for f in *png ; do convert -quality 100 $f `basename $f png`jpg; done
Then use encoder to create an avi file.
mencoder "mf://*.jpg" -mf fps=5 -o ModisTerra_Gocek.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800
I wanted my animation to display slower but setting the frame rate less than 5fps confused vlc, my favorite open source movie player (http://videolan.org) :
[00000420] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
So I created the animation at 5 fps but reduced the playing speed from vlc.
It is also possible to view the animation with mplayer. Mplayer can even display a movie with a frame rate of 1 fps, no problems. One can adjust the move playing speed by pressing the [ and ] keys.
Friday, March 27, 2009
GoogleEarth problem in Linux
With googleearth 5.0.11337.1968 (beta), if you get the following error in Ubunutu Interpid :
googleearth-bin: relocation error: /usr/lib/i686/cmov/libssl.so.0.9.8: symbol BIO_test_flags, version OPENSSL_0.9.8 not defined in file libcrypto.so.0.9.8 with link time reference
Do the following :
In the install dir :
sudo mv libcrypto.so.0.9.8 libcrypto.so.0.9.8.old
sudo ln -s /usr/lib/libcrypto.so libcrypto.so.0.9.8
googleearth-bin: relocation error: /usr/lib/i686/cmov/libssl.so.0.9.8: symbol BIO_test_flags, version OPENSSL_0.9.8 not defined in file libcrypto.so.0.9.8 with link time reference
Do the following :
In the install dir :
sudo mv libcrypto.so.0.9.8 libcrypto.so.0.9.8.old
sudo ln -s /usr/lib/libcrypto.so libcrypto.so.0.9.8
Monday, March 23, 2009
Tuesday, March 3, 2009
Adding a new PGP key with apt-key
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 5227BEBD68436DDF
Sunday, February 22, 2009
Changing the projection of a spatial data using ogr2ogr and gdalwarp
Changing the projection of a shapefile using ogr2ogr :
Download and install ogr/gdal (yes, it's free).
To create output.shp with the WGS84 (4326) projection, use the following syntax :
ogr2ogr output.shp -t_srs "EPSG:4326" input.shp
To simply extract Features 1,2,3 and export into GML :
ogr2ogr output.gml input.tab -f "GML" -where "fid in (1,2,3)"
Similarly, use gdalwarp for raster data :
gdalwarp -t_srs 'EPSG:4326' input.tif output.tif
voilĂ
Download and install ogr/gdal (yes, it's free).
To create output.shp with the WGS84 (4326) projection, use the following syntax :
ogr2ogr output.shp -t_srs "EPSG:4326" input.shp
To simply extract Features 1,2,3 and export into GML :
ogr2ogr output.gml input.tab -f "GML" -where "fid in (1,2,3)"
Similarly, use gdalwarp for raster data :
gdalwarp -t_srs 'EPSG:4326' input.tif output.tif
voilĂ
Thursday, February 12, 2009
Firefox not resizable in Ubuntu 8.10 Interpid
The borders of Firefox disappeared. It is not sizeable anymore. Ennoying!
After pressing F11 twice, the problem is gone!
After pressing F11 twice, the problem is gone!
Skype audio problem in Ubuntu 8.10 Interpid
Subscribe to:
Posts (Atom)