Day: 10 February 2010

  • diary of a geonumpty

    I have a GIS problem:

    There are two layers in the map above:

    • the green areas represent land lots, with owners Arnold, Beal, Carr, …
    • the red points represent wind turbines, or really anything that needs to be identified inside a lot.

    While I used to be quite decent with plain ol’ SQL, the spatial extensions (such as are in SpatiaLite) are nipping my heid. What I need to query:

    1. How many turbines does each land owner get?
    2. Are there any turbines that aren’t in a lot?

    Here’s the data, and I’ll show you a solution once I work it out.

    Update: dang, the SpatiaLite tutorial is useful. Here’s how to get the count for each owner:

    select Properties.owner, count(*) from Points, Properties where within(Points.geometry, Properties.geometry) group by Properties.owner;

    which gives:

    Owner count(*)
    Arnold 1
    Beal 2
    Dockrill 2

    Nifty, what!? Now to work out the other one, which I suspect will use a ‘not within()’.

    Update #2: Nope, the SpatiaLite mailing list came through:

    SELECT id,
           unitid
    FROM   points
    WHERE  id NOT IN (SELECT points.id
                      FROM   points,
                             properties
                      WHERE  Within(points.geometry,properties.geometry));
    

    I have to admit that I still don’t really think of nested SELECTs – my SQL formative years were spent on a DB that didn’t support them.

  • amiga emulator for iPhone – sorta whee

    Emulated Commodore Amiga Games sounds like a good idea, but each game has to be sold as a separate app so the dreaded FEATURES of the computer aren’t allowed out.

  • beacoup fish

    I just downloaded the first 1000 Fish Disks from Aminet. Back in the day, that would have cost me £3000, and would have involved serious floppy storage. As is, it took just a couple of hours.

    I used to write for short-lived PD Shopper magazine. There was one flaw in the business plan; trying to sell a magazine to people who were naturally inclined to be cheap. As soon as shovelware CD-ROMs became available, PD Shopper vanished.

  • empty threat

    This is the clickwrap login usage licence at work. The threat of ” is particularly chilling.

  • something went wrong

    Something went very wrong when my Thinkpad booted up:

    Pretty, though.