Masthead

Using BlueSpray with PostgreSQL

Introduction

BlueSpray is a java-based GIS application and is available at the SchoonerTurtles web site. For this exercise, you'll want to use the latest alpha release. BlueSpray allows just about any SQL query to be executed against a database making it more flexible than QGIS.

  1. Download the latest aphla release of BlueSpray from the www.schoonerturtles.com web site into a folder on your virtual machine.
  2. Unzip the folder.
  3. Navigate to the folder using the Ubuntu GUI.
  4. Inside the folder, right click and select "Open Terminal Here". This will open a command line window which is the old UNIX-style interface.
  5. Type "java -jar BlueSpray.jar" and press "Enter". This tells Ubuntu to run BlueSpray in the Java Virtual Machine which is included with OSGeoLive.
  6. You should see the BlueSpray interface appear.
  7. Right click on "Scene" in the project tree and select "New Database...".

In the dialog that appears, change the "Host", "Username", and "Password" as needed. You will only need to change the "Port" if you installed PostgreSQL on a different port than 5432. Click "Update Databases Below" to update the list of databases from the database server.

BlueSpray Database Connection Dialog

Settings to load data from the "natural_earth2" database included with OSGeoLive.

Next, click on the "Query" table and select "Regions" as the "Layer Type" to load geometries from the database. Then, you can either select an entire table to load from the datbase or enter a PostgreSQL query into the box provided. My advice is to create queries in the PostgreSQL query editor, make sure the work, and then paste them into the "Query" box. Clicking "Update Field Names" will then allow you to select the column that contains the "Shapes" (geometries). You can select an "ID Column" if you which to edit and update the data.

BlueSpray Dtaabase Query Dialog

 

Clicking OK with the settings above will provide the countries as shown in the image below.BlueSpray with a country layer

 

We can also execute more complex queries such as the one below which will load any country whose name includes "united".

Note that BlueSpray currently needs to have the geometry field returned as text ("ST_AsText(geom)") and a "*" for the SELECT will not return spatial data.

BlueSpray with United Country query

BlueSpray with results of querying countries with united in the name

 

More Resources

SchoonerTurtles Web Site

© Copyright 2018 HSU - All rights reserved.