Posts Tagged ‘ OSGeo ’

Adding elevation data to a point layer from a DEM

I’ve put together a Python script that uses pyqgis to add elevation data from a DEM to the attribute table of a point layer.  I’m going to use it to compare the elevations recorded by my Edge 500 to elevations derived from local DEMs.  I pieced the script together with tons of help from the PyQGIS Cookbook.

Here’s what I came up with.  It requires both the point layer and DEM to be in the same projection.

Continue reading

Use QGIS to generate contour lines from a DEM

This guide will help those who have used ESRI software in the past to create countour line datasets.  Instead of spending big bucks on ArcDesktop and the Spatial Analyst you can do this for free with QGIS.

The first step is to load your DEM data.  QGIS uses GDAL to handle raster datasets, and GDAL can load almost every format out there.  Seriously, GDAL is awesome.  Once you have loaded your data make sure it is in the correct projection by right clicking the layer in the table of contents, the select Set Layer CRS.  You’ll also want to set the project to your layer’s CRS, you can either use the Set Project to Layer CRS in the same menu, or go to File, Project Properties, and click the Coordinate Reference System tab.

In other GIS software your DEM may automatically be drawn with a grayscale or colormap already set.  In QGIS by default you’ll only see a gray rectangle.

DEM Loaded

QGIS displaying a DEM with no colormap or grayscale stretching.

On the style tab of the layer properties menu you can select how you want your raster to be symbolized.  Here’s the same layer displayed with elevations represented by pseudocolors:

QGIS pseudocolors

DEM displayed with pseudocolors

To generate contours click Raster, then Extraction, then select the Contour menu.

QGIS Contour menu

QGIS contour menu.

The menu is pretty self explanatory.  It is a front end for the gdal_contour command line tool.  You can use the generated command at the bottom as the starting point for a batch file if you have several files you need to convert.

DEM with contours

Contour lines sitting on DEM they were created from

Easy peasy!

Geos 3.3.2 is in the Community repository

Geos 3.3.2 hit Arch’s Community repository yesterday.  This is big since now all three of PostGIS‘s dependencies (GEOS, Proj, and Postgresql) are now fully up to date which should make the update to PostGIS 2.0 go as smoothly as possible.

Batch Geocoding with TIGER Geocoder 2010

I’m compiling a database of all the microbreweries in my state.  So far I’ve got a list of 43 breweries and their addresses.  I’ve geocoded them against the 2010 TIGER street centerlines.  I used a batch geocoding example from PostGIS in Action the basis for this query.

Continue reading

MapServer on Arch Linux

MapServer isn’t in Arch‘s package repository.  There are two older versions in AUR, but they are not currently maintained.   Luckily, MapServer is very straight forward to compile and install on its own, it isn’t updated on a weekly basis so it is easy to keep current, and it is the sort of software that once you find a version that works for you you tend to want to keep it.  All this makes it a great candidate for you to compile and install it yourself.

Continue reading