Categories
All Scotland

Crowdsourced City Extents

Following up from my Glasgow Regions Mapped Update.

Alasdair Rae recently started a crowdsourcing project for four cities in the UK: London, Birmingham, Manchester, and Glasgow. Write up of the results. The post was however very popular and resulted in responses from around the world.

Since the project was created with the excellent code from Nick Martinelli, the data can be downloaded by anyone.

So I created a breakdown of the number of responses in 1 km grids for each city that received at least 5 responses.

The full album, ordered by country name and then city name can be found:

Here.

Highlights

Glasgow

The west end is the true Glasgow.
UnitedKingdom_Glasgow_extents46

Edinburgh

Very inclusive.
UnitedKingdom_Edinburgh_extents33

Liverpool

Much larger and inclusive than Manchester.
UnitedKingdom_Liverpool_extents20

London

The M25 provides a very handy limiting barrier.
UnitedKingdom_London_extents29

LA

Far reaching urban sprawl.
UnitedStatesofAmerica_LosAngeles_extents10

New York

Probably some selection bias, with crowd sourcing more popular in Brooklyn.
UnitedStatesofAmerica_NewYork_extents32

Washington

DC.
UnitedStatesofAmerica_Washington_extents21

All cities.

Categories
All Maps Scotland

Glasgow Regions Mapped – Progress Update 1

You can read the initial post at: Mapping Glasgow Districts

We have had some great progress on the mapping so far. There have been 367 regions mapped to date. However, as mentioned in the original post, there are a huge number of regions in Glasgow so even with over 300 responses many regions have only one response and others are still unmapped. But in the hopes of encouraging some more responses I felt it would be nice to show what progress has been made to date.

Statistics so far:
Unique region names so far: 241

Most mapped regions:
City Centre – 10
Finnieston – 9
Merchant City – 9
Dennistoun – 8
Partick – 7
West End – 7
Garnethill – 6
Hyndland – 6
Woodlands – 5
Hillhead – 5
Mount Florida – 5

Regions so far. Click for PDF version.
map_so_far

We can see that there are still quite a few regions that have had the same number of responses with multiple region names.

We can look at what these responses have been, in an interactive map:


Full Screen.

We can see that the West End in general has been the target of a large number of responses, so we can drill in a little further:

west_end1

Extent of the west end:

West End

Individual regions:

Anderston

Anniesland

Blairdardie

Broomhill

Charing Cross

Dowanhill

Drumchapel

Finnieston

Firhill

Garrioch

Hillhead

Hyndland

Jordanhill

Kelvingrove Park

Knightswood

Maryhill

Not Partick

Park Circus

Partick

Partickhill

Scotstoun

Thornwood

West Maryhill

Whiteinch

Woodlands

Yoker

Yorkhill

A final note, there have been some creative responses as well, as expected. But the flagging system on the mapping page has worked incredibly well.

A huge thanks if you have responded.

Categories
All Maps

Mapping an Integer

So just before Christmas I received my own “hand-crafted”, “unique”, and “hella-beautiful” integer. From Brooklyn Integers: 404578811.

http://www.brooklynintegers.com/int/404578811/

I was not initially sure what to do with it. But I had some time while waiting on points to appear in polygons so I though I would map my integer.

So we have a few combinations for co-ordinates:

  • 0, 404578811
  • 4 , 04578811
  • 40 , 4578811
  • 404 , 578811
  • 4045 , 78811
  • 40457 , 8811
  • 404578 , 811
  • 4045788 , 11
  • 40457881 , 1
  • 404578811, 0
  • And of course:

  • 404578811, 404578811
  • I have to say these do not translate very well into my current de facto co-ordinate system of British National Grid (0, 404578811 and 404578811, 0 and 404578811, 404578811 not shown).

    BNG_no_good

    Luckily we can try some alternatives. Smathermather had a great post about mapping Null Island/Archipelago, so we can re-use some code. To map our integers to a selection of CRSs.

    CREATE OR REPLACE FUNCTION integer_mapping2(
    
        crs integer,
    
        x integer,
    
        y integer)
    
      RETURNS geometry AS
    
    $BODY$
    
    DECLARE
    
        BODY geometry;
    
    BEGIN
    
    SELECT ST_Transform(ST_SetSRID(ST_MakePoint(x,y),crs), 4326) INTO BODY;
    
    RETURN BODY;
    
    EXCEPTION
    
        WHEN SQLSTATE 'XX000' THEN
    
        RETURN NULL;
    
    END
    
    $BODY$
    
      LANGUAGE plpgsql;

    We use the EXCEPTION, because some of the more awkward co-ordinate combinations cannot be translated back to EPSG:4326 without causeing a SQL error.

    Then we can create our our tables.

    CREATE TABLE my_integer_ AS
    
    SELECT srid, integer_mapping2(srid, 404578811,404578811) as geom FROM spatial_ref_sys
    
        WHERE srid > 2000 AND srid < 4904;

    Replacing 404578811_404578811 as needed.

    Mapped:

    by_co_ord

    By CRS:

    by_crs

    4,04578811:

    4_04578811

    Album of the rest.

    It really shows how fragmented the EPSG codes are for New Zealand, and to a lesser extent the US.

    Categories
    All Maps OSGEO QGIS Scotland

    Every Person in Scotland on the Map

    Winner of the 2016 OS OpenData Award for Excellence in the use of OpenData from the British Cartographic Society.

    Full size.

    The mapping process creates a random point within a building shell inside of a postcode area, which is repeated for every person in a postcode. This is in contrast to a simpler process, which does not take into account buildings at all, working simply with postcode areas. This can be seen in my previous post: Population of Scotland Mapped

    Inspired by:
    The Guardian – Every person in England and Wales on a map by Chris Cross

    Based on the 2011 Scottish Census population data.

    Data from the National Records of Scotland.

    Combined with the Ordnance Survey, Open Map product.

    Rendered with: QGIS tile writer python script.

    Categories
    All Maps Scotland

    Forth Road Bridge Closure Impact on Drive Times

    In honour of the Forth Road Bridge re-opening completely. I created a map of the impact it has had on drive times from Edinburgh.

    This is based on the OS Open Roads Product, using pgRouting, and network generated using the guide from Ross McDonald.

    This does not take into account the increase of traffic on the other routes, or traffic in general. Would be interesting to see a real impact map from one of the major navigation providers.

    Drive time with and without the forth road bridge

    Difference the forth road bridge closue caused map

    Categories
    All OSGEO QGIS

    Highlighting Selections in QGIS

    I have been working a lot with points recently, and one thing with the default selection highlighting in QGIS is that selections do not really stand out. This is especially true with point layers.

    A bit of an extreme example, but there are 15 points selected in the middle of this image.

    hard_to_see

    However, we can remedy this with the Expression Plus plugin (by Nathan Woodrow) and a rule based symbology.

    plugin

    This plugin adds a great function: isselected()

    With this we can easily create rule to symbolise features that are selected.

    The rule for symbology is as follows:

    QGIS 2.12+:

    isselected( @layer_name )

    QGIS 2.8:

    isselected( 'ACTUAL_NAME_OF_LAYER' )

    So we can see that 2.12 has added a slightly more dynamic way of applying the symbology.

    symbology

    We can now slightly more easily see our selection.

    more_visible

    But one final setting. With symbol levels we can really make the selections pop.

    symbol_levels

    Symbol levels can be set from the bottom right of the styles tab, through rendering order. We simply want out selection to have a higher number than the other symbologies. Thus being rendered in a later pass and appearing on top.

    final_selection

    Much better.

    Categories
    All OSGEO QGIS Tutorials

    Mapping Google Location Data

    A cool python script has been created that allows you to easily convert your google location (Takeout) data into a shapefile.

    You can get your data from: Google Takeout
    And you only need the “Location History – JSON format”

    The conversion python script can be downloaded from: GitHub

    The python script requires GDAL and its python bindings, but can be easily run if you installed QGIS using the OSGeo4W installer. From the advanced installer, under the Lib section.

    instruct

    Then using the OSGeo4W Shell.
    shell

    Run the command:

    python "C:\FullPath_to_Python_Script\read_location_data.py" "C:\FullPath_to_Input_File\LocationHistory.json" "C:\output_path" output_file_name ESRI_Shapefile

    Example:

    python "C:\FilePath\Takeout\Location History\read_location_data.py" "C:\FilePath\Takeout\Location History\LocationHistory.json" "C:\FilePath\Takeout\Location History" output ESRI_Shapefile

    Then just style it in QGIS as desired.
    GoogleTakeOut

    Categories
    All Scotland

    Mapping Glasgow Districts

    First update: Glasgow Regions Mapped – Progress Update 1

    Lets map the districts/regions/neighbourhoods/suburbs of Glasgow. The divisions of a city can be hard to distinguish, there are no hard boundaries between regions and these can be dynamic over time. Where does the West End begin? As soon as you cross the M8, or later? Where does the West End end? Before Partick, halfway through, or well past Scotstoun? Have your say!

    People Make Glasgow, help define its boundaries.

    This was done successfully in Boston: Bostonography – Neighborhoods as seen by the people.

    Although Boston is a significantly easier target. Their map covered 21 different neighbourhoods. According to Wikipedia, Glasgow has at least 145 districts.

    This will only be significant if we get a good number of responses. So please feel free to share!

    Made possible by: Nick Martinelli from extent(PNW). Code on GitHub.

    Map Glasgow’s Regions.