I returned to Zaporizhzhia yesterday, sunburned and a little refreshed. The heat in Crimea is terrible, and the proximity of the sea does not help. In Choban-Kale, at 11 o’clock in the afternoon, we had 53°C in the direct sun (they say it was almost 60°C in Simeiz), and the water temperature was ~28–29°C. However, it is no better in Zaporizhzhia.
While I was on holiday, the next version of QGIS - 1.5.0 “Tethys” - was released. The official announcement is on the QGIS blog. There are many changes: a lot of bugs have been fixed, new tools have been added, and old tools have been improved (fTools, GdalTools, annotations, new georeferencing module). The documentation is actively updated.
I am leaving for Crimea tomorrow morning at 6 a.m. and will be back late in the afternoon on the 5th.
I will not have internet access there, but you can write to me :-). I promise to answer all emails, comments, bug reports and feature requests when I’m back.
Marco Hugentobler has implemented initial support for table joins in QGIS. If you want to try out the new functionality, you can get the source code from the new branch of the repository
svn co https://svn.osgeo.org/qgis/branches/table_join_branch table_join
and build it.
To join a table to a layer’s attribute table, you need:
add a vector layer to a project
add a table to a project (e.g. by going to the “Layer → Add vector layer” menu and selecting a *.csv or *.dbf file)
open the vector layer properties dialog and select a “Join” section. Then click on a “+” button to add a new join
select the fields that will be used to create the join and press “OK” button
new fields from the joined table should appear in the layer’s attribute table, as well as in the “Attributes” tab of the layer properties dialogue and in the “Identify Results” dialogue
As this feature is still in the early stages of development, there are some issues:
joined fields are read-only, their values cannot be changed
poor performance, especially when performing classification or searching on joined fields
I have noticed that recently many people have asked how to get image coordinates (row, column) from real world coordinates (latitude/longitude). The following code shows how to do this in the QGIS Python console:
GdalTools (or Raster Tools) is a plugin for the open source GIS QGIS. The main purpose of the plugin is to simplify the use of the GDAL command line utilities by providing the user with a graphical interface for the most common operations.
Initially, the plugin was developed by Faunalia, later other developers, including myself, joined them. Robert Szczepanek created nice icons for most of the tools, and the development of some features was sponsored by Silvio Grosso.
At the time of the first announcement (September 2009), the plugin provided only two tools: gdalbuildvrt and gdal_contour. Now the number of integrated tools is approaching 20.
Installation
There are two versions of the plugin:
stable (1.2.0 at the time of writing)
experimental (potentially unstable but with new features and tools)
Both versions are available from the Faunalia repository. To install the experimental version, it is necessary to enable experimental plugins in the Python Plugin Installer, otherwise, the stable version of GdalTools will be installed. Since the stable version of GdalTools is included in QGIS 1.5.0, users of this (and any later) version don’t need to install it manually. However, they can replace the stable version with the experimental version from the repository if desired or necessary.
To install the GdalTools plugin from the repository, follow the steps below:
open the Plugin Installer (“Plugins → Fetch Python Plugins…”)
go to the “Repositories” tab and add third-party repositories by clicking on the “Add 3rd party repositories” button
go to the “Options” tab and enable experimental plugins (“Show all plugins, even those marked as experimental”)
go back to the «Plugins» tab and find “Gdal Tools” in the list of plugins
select corresponding row and press “Install plugin” button
wait until the plugin is downloaded and installed
restart QGIS when asked
The plugin requires GDAL/OGR and the corresponding Python bindings. If QGIS is installed via the OSGeo4W installer, the required packages are called gdal16 and gdal16-python. If you are a Windows Vista/Seven user, please note that error messages may appear, check the OSGeo4W bugtracker for a solutions.
Mac OS X users should open the GdalTools settings dialogue box after installing the plugin and specify the directory where the GDAL utilities are located.
How does it work
Each tool requires the user to specify the input data (this can be either a layer loaded into QGIS or a file on disk) and configure some of the tool’s parameters.
This information is then used to generate a command line for the appropriate GDAL utility, which is then executed.
The generated command is displayed at the bottom of the tool’s window. If desired, it can be copied and run directly from the command line. This can be useful if you need to use additional options that are not available via the GUI.
Available tools
GdalTools now includes the following tools:
Build Virtual Raster — creates a virtual raster (VRT) from a set of input files, uses gdalbuildvrt under the hood
Contour — generates a vector contour file from the input raster representing the elevation model (DEM), based on the gdal_contour utility
Rasterize — used to transfer (“burn”) vector data (points, lines, polygons) into a raster file. Vectors are read from
OGR-compatible data source, and must be in the same coordinate system as the raster.
coordinate system as the raster. On-the-fly reprojection is not provided.
Polygonize — creates vector polygons for all connected regions of pixels sharing a common pixel value. Each polygon is created with an attribute indicating the pixel value of that polygon. A raster mask may also be provided to determine which pixels are eligible for processing. This is a GUI for gdal_rasterize
Merge — creates a mosaic from a set of images. All images must be in the same coordinate system and have the same number of bands, but they can have different resolutions. If there are overlaps, the last image is copied over earlier ones in such areas. This tool is a GUI for gdal_merge utility
Sieve — removes raster polygons smaller than a provided threshold size (in pixels) and replaces them with the pixel value of the largest neighbour polygon. The result can be written back to the existing raster band, or copied into a new file. Under the hood uses gdal_sieve.py script
Proximity — generates a raster proximity map indicating the distance from the center of each pixel to the center of the nearest pixel identified as a target pixel. Target pixels are those in the source raster for which the raster pixel value is in the set of target pixel values. Uses gdal_proximity.py script
Near Black — scans an input raster and tries to set all pixels that are nearly black (or nearly white) around the collar to exactly black (or white). This is often used to “fix up” lossy compressed rasters so that color pixels can be treated as transparent when mosaicing. Based on the nearblack utility
Warp — reprojects the input raster to any supported projection. It can also apply GCPs stored with the image if the image is “raw” with control information. This tool supports batch mode, allowing multiple files to be reprojected at once. Based on the gdalwarp
Grid — creates regular grid (raster) from the scattered data read from the OGR (vector) datasource. Input data will be interpolated to fill grid nodes with values, you can choose from various interpolation methods. Under the hood uses gdal_grid
Translate — converts raster data between different formats. Like Warp, this tool can also work in batch mode, processing multiple input files at once. Uses gdal_translate utility.
Information — lists various information about a raster, it is a GUI for gdalinfo tool
Assign Projection — assigns or replaces projection information for input raster. This tool supports batch mode and recursive directory traversal. Under the hood calls gdalwarp.
Build Overviews — builds or rebuilds overviews (often called “pyramids”) for input rasters, supporting multiple downsampling algorithms. Overviews speed up the rendering of rasters. This tool supports batch mode and relies on the gdaladdo utility.
Clipper — extracts a rectangular area from an input image or several neighbouring images and saves this fragment as a new raster. Uses gdalwarp
RGB to PCT — computes an optimal pseudo-colour table for a given RGB raster and converts that raster into a pseudo-colored image. Supports batch processing, under the hood uses rgb2pct
PCT to RGB — converts a pseudo-colour band of the input file into RGB raster in the desired format. Supports batch processing, under the hood uses pct2rgb
I have been using PeopleNET as my ISP for quite some time. The speed was not very high, and the only plan available was pay-per-gigabyte. But it was more than enough for email, jabber and most websites.
There were simply no other options. Ukrtelecom cited a lack of technical capacity and offered to pay a fee and wait for the capacity to appear (they could not give an estimate of how long this would take). Beeline said they couldn’t provide service to this address, although they had connected the house next door. And there have never been any LANs in our neighbourhood, and if there were, they were very far away and not for a long time.
The Telza ISP didn’t make any excuses or problems, they just pulled the cable through a block and a half. So now I have internet like this
And PeopleNET was left as a backup and travelling option. Their USB modem fits perfectly into the small pocket of a laptop bag.
GDAL is a free library for working with raster and vector data, OGR is a part of the GDAL and is used to work with vector data. The command line utilities included in the library are widely used to perform a variety of tasks. Thanks to the developed API, you can work with OGR functions from many programming languages. This article is dedicated to using the OGR API in Python and is based on the GDAL Vector API Tutorial.
There has been less work lately, and I have more free time to spend on interesting and useful things.
I have resumed work on GdalTools, but the frequency and number of commits are not as high as before. Mostly small improvements and bugfixes.
From time to time, I fix bugs in my own and other people’s QGIS plugins. I also write articles and notes, not often and not very long, but still. If someone had told me 5-10 years ago that I would be writing articles, I would not have believed them. But here we are.
I’m involved in polishing and improving fTools, which is where my more or less active participation in the life of the QGIS project began: just today I submitted three more patches and picked up a few more bugs to fix.
I plan to get my hands on Ubuntu (and thus Debian) and the process of creating a LiveCD, because I want to participate in the creation of a localised (Ukrainian and Russian) version of Arramagong — LiveCD/DVD for GIS specialists.
And with the possibility that QGIS will eventually migrate from Subversion to Git, it’s a good idea to improve my skills with that version control system.
GDAL is a free library for working with raster and vector data. The command line utilities included in the library are widely used to perform a variety of tasks. Thanks to the developed API, you can work with GDAL functions from many programming languages. This article is dedicated to using the GDAL API in Python and is based on the GDAL Raster API Tutorial.