1. PostGIS ‘select’ statement as vector layer in QGIS

    Tue 27 April 2010
    cfarmer

    Several colleagues of mine have asked whether it is possible to visualise the results of a SELECT statement on a PostGIS database that returns spatial data in QGIS. In other words, can we map the results of something like:

    SELECT id, st_union(the_geom) FROM spatial_table GROUP BY id;
    

    My usual answer to this in the past has been “not yet…”, but now thanks to Giuseppe Sucameli and Jürgen E. Fischer, the answer is a resounding “yes!”. A recent patch to QGIS trunk now makes custom Postgres queries possible via the postgres data provider.

    read more

    comments

  2. Parallel bootstrapping with R

    Wed 21 April 2010
    cfarmer

    In a recent post, I mentioned that I was testing the stability of clusters generated from a modified network partitioning algorithm using bootstrap resampling techniques. I also mentioned that I was doing this in R, using the very nice foreach package published by REvolution Computing. To show just how nice this package is, below is a minimal example of bootstrapping a network partitioning algorithm which takes advantage of a multicore processor:

    read more

    comments

  3. Voronoi polygons with R

    Wed 16 September 2009
    cfarmer

    To create a nice bounded Voronoi polygons tessellation of a point layer in R, we need two libraries: sp and deldir. The following function takes a SpatialPointsDataFrame as input, and returns a SpatialPolygonsDataFrame that represents the Voronoi tessellation of the input point layer.

    read more

    comments

  4. Python, Matlab, and R

    Wed 12 August 2009
    cfarmer

    One project I’m working on at the moment involves exploring a dynamic extension of the Isomap algorithm for visualising constantly varying real-world road networks. Currently, we are testing out the method on a small scale simulated road network, and most of the original code (written by Laurens van der Maaten, with updates by Alexei Pozdnoukhov), was done in Matlab. Since this work is eventually going to have to run on relatively large datasets, and probably behind the scenes on a server somewhere, we decided that Python was the way to go. The goal therefore was to reproduce the Matlab code using only Python libraries, and the fewer additional libraries required, the better.

    read more

    comments

  5. Watch’ long running processes

    Wed 08 July 2009
    cfarmer

    The other day I was loading a shapefile of approximately 11 million records into a PostGIS database (stay tuned for more on that later) and I wanted to know when shp2pgsql was done. Instead of continually checking the console, I decided to ‘watch’ the process using the *nix command watch. I discovered this handy tool a while ago, and have found that for long running processes, I can use watch to notify me when the process has finished, using the following command:

    watch -ben 1 "ps u -C shp2pgsql"
    

    read more

    comments

  6. Syntax highlighting with PyQt

    Thu 02 July 2009
    cfarmer

    A few months ago I decided to add syntax highlighting capabilities to a piece of software that I have been working on. Since it is a PyQt based application, the obvious choice for implementing syntax highlighting was to use Qt’s QSyntaxHighlighter. Unfortunately, there weren’t many examples around that implemented syntax highlighting in Python, so I decided to post my own.

    read more

    comments

  7. Open up your online maps with OpenStreetMap

    Mon 26 January 2009
    cfarmer

    OpenStreetMap (OSM) is a project designed to create and provide free spatial data (street maps) to anyone and everyone who wants them. It is based on an open-source philosophy, and combines wiki-like user generated data, with free access, allowing users to create, edit, download, and use OSM data to their hearts content. According to the OSM website, “the project was started because most maps you think of as free actually have legal or technical restrictions on their use, holding back people from using them in creative, productive or unexpected ways.” There are now tones of websites and open-source software projects that incorporate OSM data, and the growing popularity of the site means that the data is only going to get better (more accurate) and bigger (more data).

    read more

    comments

  8. Understanding spatial reference systems

    Mon 12 January 2009
    cfarmer

    For those of you who are still unclear about what exactly a spatial reference system is, how it is used, and what it means for your data, I found a pretty good quick guide to spatial references, coordinate systems, projections, datums and ellipsoids. This article was written by Morten Nielsen (who works for ESRI), and it does a good job of quickly and simply describing what makes up a spatial reference system, and some of the errors that people make when talking about their spatial data.

    Having a good grasp of this stuff is important when working with spatial data ...

    read more

    comments

2 / 3

twitter

recent visitors