Tag: Howto

Working with GPS in Android apps

22.09.2011 14:36 ·  Notes  ·  android, howto

Most Android devices can determine their position with some accuracy. This is achieved by using the Global Positioning System (GPS), triangulation from mobile network base stations, or by using open (public) hotspots. To use these features, we need the android.location package.

There are several classes in this package. The most important ones are:

Other classes that are worth mentioning are Location (geographical location of the device at a given point in time) and Criteria (criteria for selecting a provider).

In this post, I will focus on getting coordinates from the GPS_PROVIDER provider.

Read more ››

How to extract raster's georeferencing

27.07.2011 15:41 ·  GIS  ·  python, gdal, howto

It is no secret that one of the most common raster formats, TIFF, is able to store georeferencing information within the file, turning it into a GeoTIFF. Everything would be fine if it weren’t for one nuance: the vast majority of graphic editors suffer from “star fever”, believing that unrecognised tags have no place in the file and happily removing this valuable information when saving the file.

This feature of graphic editors is often used to “reset” georeferencing (for example, if the image is incorrectly georeferenced and needs to be georeferenced from scratch). A natural question arises: what to do if you need to edit the image in a graphics editor but do not want to lose the georeferencing? The answer is not original, it is necessary to save it in an external file (the so-called world file).

Let’s consider three possible solutions.

Read more ››

Creating a raster composite from separate bands in QGIS

02.06.2011 13:24 ·  GIS  ·  qgis, howto

Often, novice QGIS users who have downloaded satellite images from Earth Explorer or other sources ask themselves: “What do I do with these files, and why do I see a black rectangle or a black and white image instead of a nice color image?” The thing is that satellite images are usually distributed as separate files, each of which corresponds to a specific radiation range (channel). To get a beautiful and informative image, these channels (often called bands) should be combined, and then, depending on the task, we need to choose the right band combination.

In this post I will show you how to do this in QGIS. I will assume that QGIS is already installed and that you already have a set of rasters that make up a multi-band image, such as a Landsat scene.

Read more ››

Building MOD14_SPA

23.05.2011 13:33 ·  GIS  ·  howto

MODIS Active Fire Product (MOD14) Science Processing Algorithm MOD14_SPA is an open-source implementation of the MODIS space imagery fire detection algorithm. You can find binary builds of the tool on NASA’s Direct Readout Laboratory (DRL) site, but only for some (rather old and 32-bit) Linux distributions. Fortunately, you can also download the source archive and build the tool yourself. In this post, I will show you how to do that.

Read more ››

Creating a package for OSGeo4W

06.05.2011 19:23 ·  GIS  ·  osgeo4w, howto

OSGeo4W is a special installer focused on the distribution of various free and open-source GIS software on Windows operating systems (XP, Vista, etc.). With OSGeo4W you can install GDAL/OGR, GRASS, MapServer, OpenEV, uDIG, QGIS and many other packages (see the full list).

Installing OSGeo4W requires only a few simple steps:

After installation, desktop applications can be started from the “Start → Programs → OSGeo4W” menu. Command line utilities can be run from the OSGeo4W Shell, and web applications will be available at http://localhost/.

In this post, I will go through the main steps needed to prepare and add a new package to OSGeo4W, based on my experience of creating packages for matplotlib and TinyOWS, and information from the OSGeo4W Wiki.

Read more ››

Getting started with openModeller

02.05.2011 10:00 ·  GIS  ·  openmodeller, howto

Let’s take a look at openModeller, a flexible, robust, open source and cross-platform framework for running ecological niche modelling experiments.

Read more ››

Building TinyOWS on Windows with MSVC

30.04.2011 10:59 ·  GIS  ·  tinyows, howto

A small tutorial on how to build the current version of TinyOWS (the so-called trunk) under Windows XP Professional using Microsoft Visual C++ 2008 Express Edition and libraries from OSGeo4W.

Read more ››

Adding a layer list widget to a PyQGIS application

14.02.2011 09:31 ·  GIS  ·  qgis, python, howto

QGIS is not only a ready-to-use desktop GIS, but also a set of libraries that can be used to create custom GIS applications. Unfortunately, when creating such applications, developers have to implement some GUI elements from scratch. An example of such a widget is the list of loaded layers (sometimes incorrectly called a legend).

In this post I will show the process of embedding a layer list widget into a PyQGIS application. The widget was developed by Germán Carrillo and you can get the code and read how to use it in Germán’s post “Layer list widget for PyQGIS applications” on the GeoTux blog.

Read more ››

Geographic coordinates to raster (row, column) coordinates

21.07.2010 15:37 ·  GIS  ·  qgis, python, howto

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:

import math # needed for floor() function
iface = qgis.utils.iface
# let's assume that raster is a current layer
layer = iface.mapCanvas().currentLayer()
# geographic coordinates
x = 75.0791666
y = 57.2541666
extent = layer.extent()
width = layer.width()
height = layer.height()
# raster resolution (pixel size)
xres = (extent.xMaximum() - extent.xMinimum()) / width
yres = (extent.yMaximum() - extent.yMinimum()) / height
# calculate raster coordinates (row and column)
col = int(math.floor((x - extent.xMinimum()) / xres))
row = int(math.floor((extent.yMaximum() - y) / yres))

Nothing complicated or fancy. The same code can be used in plugin with minimal changes.

Working with vectors using GDAL and Python

15.04.2010 09:55 ·  GIS  ·  gdal, python, howto

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.

Read more ››