Importing CSV files into PostgreSQL using the DB Manager in QGIS

There is very useful tool in QGIS that can import very large CSV files into PostgreSQL rapidly and reliably. The DB Manager’s “Import Vector Layer” tool. Contrary to its highly misleading title it can import CSV files as well. Open the DB Manager (menu Database – DB Manager). Then select the database where you want to store your table and click the “Import layer/file” icon.

Icon_to_ClickFrom the Import Vector Layer GUI, locate our CSV file on disk and enter the name of your new table in the Table box and click OK. Yes, it’s that simple. Proceeding this, you may need to select an text encoding scheme, files created on Windows often use ISO-8859-1 (Latin-1) instead of UTF-8 encoding. In my case, I was able to import a large statistical data set describing the energy efficiency of 525,500 Irish homes (432 megabytes) into PostgreSQL in ~15 minutes. After the CSV file is imported, you can optionally add it to your project using the DB Manager, right-click the table and select Add to Canvas. Don’t use the “Add PostGIS Layers” menu, it’s not a PostGIS layer.

Import_GuiAnd one more useful tip. You can convert Tab delimited text to CSV using QGIS. Load a Tab delimited text file into QGIS using the Add Delimited Text Layer GUI, then right click the imported file in the layer panel and save it as a CSV file.

CartoDB wins best “high-growth web entrepreneur” at the 2014 European Web Entrepreneur of the Year Awards

CartoDB, the FOSS powered web mapping solution, was honoured at the 2014 European Web Entrepreneur of the Year Awards along with three other companies at Dublin’s Web Summit on November 7th. The awards, presented by a European Commission backed body, were announced after a six month competition that involved public voting across four categories. CartoDB won the award for best “high-growth web entrepreneur”. CartoDB now has a growth rate of over 15% per month and customers in over 30 countries.

In September, a partner company of CartoDB, Kudos Ltda., released a plug-in that allows QGIS users to view, create, edit and delete data stored on their CartoDB accounts. Here is a map I created with the help of the new CartoDB plug-in that shows mountains and hills across the contiguous United States in the form of a heat map.

CartoDB and QGIS illustrate the exciting convergence between web hosted and desktop GIS, where interactive maps created in QGIS can be quickly published on the web and viewed by a worldwide audience.

FinalCartoDB

The Coastal Vignette

Vignette2

Coastal Vignette seen on an old Irish ‘6-Inch map’

Occasionally on old maps you may see a pleasing decorative effect on bodies of water called a “Coastal Vignette”, these are fine lines that highlight coastlines and lake shores. The example seen above is from a ca. 100 year old “6-inch map” of Lough Nafooey in County Galway, Ireland. I presume the Coastal Vignette effect in this example was hand drawn, it required considerable skill and patience.

These is no plugin for creating Coastal Vignettes in QGIS just yet, so I developed a simple technique to recreate the effect using the raster Proximity (Raster Distance)’ algorithm accessible in the Processing Toolbox.

In order to use the Proximity Analysis tool I first converted a Shapefile polygon depicting the sea off Dublin into a 10 by 10 metre resolution Raster using the menu command ‘Raster – Conversion – Rasterize (Vector to raster)’.

Box

This generated a Raster that coded the Sea as ‘1’ (white) and ‘0’ (black) for Land.

Next, I selected ‘Proximity (raster distance)’  from the Processing Toolbox – (GDAL/OGR) – [GDAL] Analysis – Proximity (raster distance). You can quickly find the command by typing the algorithm’s name in the box above the Processing Toolbox.

Screenshot5

I entered 0 in the ‘Values’ box, this tells the Proximity algorithm to measure the distance away from land (a value of 0). The resulting Raster contains cell values that correspond to the distance away from the coast in metres, which I styled below.

The final step is to create Contours Lines from the Proximity analysis result using the menu item Raster – Contour. In my case I used an “interval between the contour lines” of 200 metres and I added an Attribute name called “DIST”.

Screenshot7

The resulting contour lines have distance attributes attached to them can be used to create a Graduated colour style if needed, though in my cause I manually edited the attributes of 10 contour lines nearest the coast and I gradually increased the transparency of the mid-grey contour lines from opaque at the coast to fully transparent out at sea. I made the remaining contour lines transparent.

And here is the finished result, with the Sea and an OpenStreetMap base map styled to look just like Google Maps.

Finished Vignette 2

QGIS Wrocław, Lisboa, Dufour, Valmiera and ?

QGIS 2.4 will be codenamed “Chugiak” in honour of the project founder Gary Sherman who lives in Chugiak, Alaska. This will be the 6th release to bear a codename named after a terrestrial locality, versions 0.8.1 through 1.5 were named after the moons of Jupiter and Saturn e.g. Titan, Io, Tethys etc. The tradition of naming QGIS releases after celestial and terrestrial locations aims to reduce legal risks involving trademarks. QGIS 2.4 will be released at Noon Alaska Time on Friday 20th June (21:00 Irish Standard Time).

Announcement – Swiss QGIS User Group

Orfeo Toolbox – Satellite Remote Sensing for QGIS

OTB1

Orfeo Toolbox 4.0 (OTB) is now available for QGIS on Ubuntu 13.10 and 14.04 via the UbuntuGIS Unstable repository (it was previously available for earlier versions of Ubuntu and separately MS Windows via OSGeo4W). OTB, which can be accessed via the Processing Toolbox, provides QGIS with advanced satellite remote sensing capabilities, the sophistication of which maybe best appreciated upon thumbing OTB’s rather daunting 732 page manual.

OTB is a library of image processing algorithms based on the medical image processing library ITK v4, adapted for analysis of high resolution satellite imagery. Its algorithms are tuned to cope with huge images, that normally require supercomputer facilities, by using streaming and multithreaded processing.

The OTB project was initiated the French Space Agency (CNES) in 2006 with the objective to provide a suit of opensource tools for the analysis of images produced by the Orfeo constellation of satellites; Pléiades and Cosmo-Skymed. The motto of OTB is “Orfeo Toolbox is not a Black Box”, its algorithms are openly documented and its source code can edited by end users under the GNU compatible French CeCILL opensource license agreement.

The capabilities OTB have greatly increased since its initial release 8 years ago, especially with the release of version 4.0 in Feb 2014. It can now handle the optical sensors of SPOT, QuickBird, WorldView, Landsat and Ikonos, various multispectral sensors (e.g. Hyperion) and synthetic aperture radar imagery of TerraSarX, ERS and Palasar amongst others.

OTB’s sister application Monteverdi 2 can be installed as well. Monteverdi is a GUI batch processor for OTB that allows building complex processing chains by selecting algorithms from a set of simple drop down menus. As for future developments, the following is a demo of Orfeo Toolbox 4.0 controlled via Monteverdi 2.0, it uses the forthcoming OpenGL accelerated ICE API:

Reference:

Inglada, J. & Christophe, E. 2009. The Orfeo Toolbox Remote Sensing Image Processing Software. In: IGARSS (4). 733–736.

QGIS Podcast episode 7 now online

In the latest QGIS Podcast, Tim Sutton interviews Martin Dobias, a core developer of QGIS. Martin discusses recent developments in the QGIS project such as multithreaded rendering, python bindings and improved symbology. Multithreaded rendering, due out with QGIS 2.4, releases the full potential of modern multicore CPUs, resulting in improved responsiveness and a substantial speed-up in map rendering speed.

Podcast episode 7