Stuff that occurs to me

All of my 'how to' posts are tagged here. The most popular posts are about blocking and private accounts on Twitter, also the science communication jobs list. None of the science or medical information I might post to this blog should be taken as medical advice (I'm not medically trained).

Think of this blog as a sort of nursery for my half-baked ideas hence 'stuff that occurs to me'.

Contact: @JoBrodie Email: jo DOT brodie AT gmail DOT com

Science in London: The 2018/19 scientific society talks in London blog post

Showing posts with label google maps. Show all posts
Showing posts with label google maps. Show all posts

Friday, 30 October 2015

How to make a Google Fusion table map (ie a zoomable map of addresses) for Sherlock special cinemas

Note: be careful if you are using this mapping tool when dealing with people's addresses - it is easy to make their data public (uploading to web, sharing with others) without meaning to. In this example the data come from already-public cinema addresses. 

I'm looking forward to seeing the Sherlock Special ('The Abominable Bride') at New Year, it's going to be shown on BBC One on New Year's Day but also in cinemas around the world - in Australia, Canada, New Zealand, United States and here in the UK. The Sherlockology website has a meta-list of country pages and more cinemas, and countries are being added (this is the current UK listing).

I thought it would be fun to take the alphabetic list of UK cinemas and put them on a map, that looks like this.


You can zoom in and out of the map and click on any of the red dots to see details of where each cinema is. For the next update I'll add some colour to mark cinemas that have Dolby Atmos sound systems (the Sherlock special is apparently mixed for Dolby Atmos). Most of the cinemas don't have Dolby systems and of those that do most have 3D or 7.1.

There are four stages to this
a) gathering the data
b) using Google Fusion tables to create the map
c) Troubleshooting
d) ongoing updates and improvements

A) Gathering the data
- make a table that has, at minimum, a list of postcodes or addresses - that's all you need to start
The raw data was here, each line consists of a town or city, the name of a cinema, sometimes a web address and a phone number. These data need to be put into a table which can be done in an Excel spreadsheet or a Google Drive spreadsheet (you can use your Gmail account to log in, there's no requirement to download anything you can do it all online). If you don't want to use either of these then you can upload correctly formatted data in a plain text file: .csv (comma-separated variables), .tsv (tab-separated variables), or .txt (text). I used Google Drive spreadsheets for this. 

My current spreadsheet looks like this (click to make it bigger)


I put the cinema name in one column and copied the name of the town / city into another then searched for the cinema's postcode and added those in another column. Postcodes alone are sufficient to create a Google Fusion map (it just takes address data and locates on a map ('geolocated' data)) and anything else you add means that when people click on each point they'll have more information. 

It took me an hour and a half (I was having breakfast and watching Frasier at the time so not rushing) to get all the postcodes and have a ready-to-map table, this is really the longest part of the process. Of course you can spend hours tinkering and improving but once you've got to this stage you're ready to go to the next stage, the rest of this section is about 'finessing' the data.

I've added some extra info about the cinemas' websites in two columns. For example there's a generic Odeon websites address but each Odeon cinema also has its own website. There's a column for the Dolby Sound system that the cinema has and I found the information from Dolby's own website. Some cinemas in London are listed under their local name, eg 'Covent Garden' or 'Greenwich' so I created a second column called 'area' and put those locations in there and changed the city to London.

There's also an 'icons' column which I added after making the map above (note that all the dots are red). In the next version the cinemas with Dolby Atmos will have green map-pointers, those with 3D or 7.1 will be blue and the rest in yellow, bit more colourful. It's a work in progress so there'll be more stuff added or refined.

Pro-tip
When filling in information that's currently missing use the filter icon (looks like a funnel) to show only the rows where your item of interest is currently missing. Clicking the filter icon adds to all the column headers a small downward arrow - if you click on it it will present you with a single copy of everything in that column (eg in the 'City / Town' column London features several times but will show up just once in the filtered list). You can then select, or deselect to show only what you're interested in and the rest will be temporarily hidden. Just click the filter icon again to turn filtering off.

B) Using Google Fusion tables to create the map [About Fusion tables]
- this is the probably the quickest part of the process
Once your raw data is in a tabulated form you can go to Google Fusion tables. You will need to be signed into Google to do this (or you can send your file to a Google-using friend and ask them to make the map but note that if you want to amend it later you'll have to repeat the process).

You are presented with a screen that looks like this

 1. Click on Google Spreadsheets to use a file on Google Drive, or on Browse... to choose a file on your computer. I used Google so the next screen I saw asked me to choose from my spreadsheets.

2. Just click the spreadsheet you want and press 'Select'. Then wait for the sheet to load.

3. This is the point at which you can pick 'Sheet 1' or another sheet within the spreadsheet, depending on where your data is. In most cases you'll probably only have one sheet but be aware if you're uploading a file from your computer that although it will process the data from Sheet 1 (if you choose that) I think it uploads all of them so be careful if you have sensitive data in the other sheets.



4. This is the bit where it asks you to confirm what column it should use to map addresses onto the Google map. In my case it's Postcode but it could equally be something else.

5.  This screen lets you finish importing the table by adding some information. Because the data came from Sherlockology I put their website in the Attribution page link and wrote a more detailed description that what is currently here. You can add more detail later once the map is made. Press Finish to get the data properly formatted in Fusion tables style.

6. This is what the final fusion table looks like - there are three tabs each presenting the same data in a different way. In 'Rows' you can see each row as in a spreadsheet, in 'Cards' you can see the data from each row presented as it would look on a business card - this is what's shown when someone clicks on a location pointer (the red dots) in the 'Map of Postcode' in tab 3. 

The map isn't ready though - you need to click on that tab to bring up the 'begin geocoding' options which looks like this, below.

7.  Clicking on the third tab will start the process of geocoding automatically, and once done you will see something like the map below. It's best to zoom out first to see if there are any obviously wrong map points (see the one in the US). You can click on that red dot to see its card which will tell you which row caused a problem - you may need to add in some extra detail. For example there's a Greenwich in London UK as well as one in Connecticut US.

8. Zoomed out to show that while the majority of the UK postcodes are correctly positioned at least one is in the wrong place. On a real map you can click any of the red dots to see what data point it's meant to be.

Making the red icons different colours (depending on properties)
If you've added an Icons column with different coloured icons to reflect differences in your data (in my case I've used colours to denote different types of sound systems) you will need to click on 'Change feature styles' (visible in Picture 7) and then select the Column option (basic red dots = fixed, column lets you select which column you put your icon names in, eg large_green or small_blue etc and buckets is for continuous data that you want to segment, eg Low, Medium, High).


9. Using the map feature styles option and the marker icon options to change their colour. Pick whichever column has your icon names in (you can call the columns anything you like by the way).

And here's the most recent example of the map - and I've also just spotted that yellow map icons don't work well when zoomed in though they're fine at a distance. I'm going to change them back to red! 


10. Green icons show cinemas with Dolby Atmos. Blue icons show those with Dolby Surround 7.1 or Dolby 3D, yellow ones show cinemas with no Dolby system in place (according to the information from Dolby's own website, which could be out of date of course - I need to check!). I've clicked on an example and you can see that data point's 'card' with relevant info. In the next update of the map this data point should also have its own local website too, and a tidy up of the original list text (last line) where the phone numbers have got a bit mangled.

Sharing your map
At the top right of every map (or Google document in fact) there's a bright blue Share button which lets you share a link for people to view only, or for them to edit, or gives you the option of inviting people by their email addresses to view (or, in the case of the originating documents, edit the data).

C) Troubleshooting
After my first map I spotted that one of the Dublin addresses was mistakenly in Poland and the NE28 postcode of the North Shields cinema appeared in the US. Limerick doesn't use postcodes but when searching for the name of the cinema on Google it showed up fine on Google Maps. So for those ones I added 'Ireland' as a location clue, or used the name of the cinema instead. Whatever works.

D) Ongoing updates and improvements
I'll write this section when there are some :)




Tuesday, 30 December 2014

Approximate aspect ratios for Google maps - post largely for me to be honest :)

This is a public memo for me for the next time I need a quick way to work out approximate aspect ratio reductions. Fiddling about with a Google map embed... it comes with defaults of 640 x 480 and no way to change it (other than by manually editing the underlying HTML code) and the preset was a little large for its purpose.

I played around with a calculator so that the larger number is about 1.3333 times the smaller one, maintaining an approx 4:3 aspect ratio.

Here's what I came up with. Might be of use to others hence sticking it here rather than just in a file.

w=640&h=480
w=530&h=400
w=400&h=300
w=320&h=240

Tempting as it is to put a big map on a blog post it rarely works well when viewing on a smartphone. Scrolling down often means you get stuck scrolling within the map, so a bit of thumb-space around the map is helpful.

Saturday, 13 August 2011

Self-updating place or event markers in Google Maps: possible?

Shortened link for this post is http://is.gd/oGokQH

Usually when I think of something I would like to do on the internet I find that someone's already come up with a neat solution, or knows how to. I'd be surprised if I'm the only person to have thought of this 'gap' in the market but a quick Google search for 'google maps markers update' brought me to pages of stuff I really didn't understand, for example...
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/3543780d6a588432?pli=1

Imagine I create a map of locations in London which are showing open air film screenings. There might be one in Wandsworth on 20 July 2011 and one in Clapham on 14 September 2011. When I added both of these screenings, say on 8 July 2011, they were green as in 'yet to happen', but now, on 13 August 2011 the Wandsworth one is finished but the Clapham one's in a couple of weeks.

Is it possible for the place/event marker to automatically change its colour once the date has passed? How do I get in touch with Google people to ask them? Is this a task for Google+?

I don't want to delete it because that stops conveying any information (and the information is "Wandsworth showed a film in 2011 perhaps it might in 2012, might be worth making a note of the website to which this marker points").

While creating the Open Air Cinema Screens post I made very good use of out-of-date information to help me find newer information. No good at all if stuff disappears.

Those 'concertina' things on web pages
While I've got your attention I'm also interested in what I think are called concertinas. These are collapsible bullet-point type lists which can be expanded / contracted depending on which bit you want to look at. Ideal for cinema listings but alas I don't know how to make them happen in Blogger. Or WordPress or any other blog platform. Do I have to get my own website to make that work?

I've tried pinching the code and using the 'edit html' button when editing a blog post here but didn't work.

Friday, 17 December 2010

Collaborative mapping of Greenwich's salt bins using Google maps

Today I rang Greenwich Council's Highways department (020 8921 5419) to find out (a) if they could grit my local pavements and (b) tell me where the salt / grit bins so that I could make a start on it myself, if feasible.

EDIT: I've since found this.
Greenwich Council FAQ "Where can I get rock salt for gritting my road or driveway?"
"You can buy bagged rock salt from your local builders’ merchant usually. We do not sell salt."

After being cut off twice I finally managed to speak to someone who read out a bit of a page of their website about the fact that the salt bins were vastly reduced in number because of budgetary constraints and vandalism. I asked if there were any near me and they managed to suggest one, admittedly not too far away but in slippy weather what's normally a ten minute walk can last a lot longer. Although they said the gritting team should be out in a couple of hours I'm pretty sure (from a look outside my window) that they haven't been. They were very helpful though and happy to try and find information for me, even though (as I discovered later) they weren't able to find the information I wanted.

I searched Twitter and Google to see if there was any better information about salt bins and spotted that @mysociety had tweeted about someone who'd created a Google Map for Sutton's grit bins and other #gritdata maps. Eventually, I managed to find the very PDF from which the council person had read bits of to me. Clearly they'd not spent much time familiarising themselves with the document as Appendix F contains the full list of local salt bins in Eltham, Greenwich (including Blackheath) and Woolwich. There are quite a lot of them, and plenty are near me. Why wouldn't someone specialising in the gritting of highways in Greenwich not know this?

Surely they could promote this data and encourage people to map it themselves - Greenwich is not short of community-minded nerds.

I decided I'd have a go at creating a Google map cos I've never created one before and it sounded like a good project. I tweeted that I'd found the information and @greenwichcouk got in touch saying they had thought about a Google map too. We collaborated (I have to say, I added really only about ten blue marker points, the bulk of the work was done by @greenwichcouk - EDIT, I have since done a goodly amount of Eltham ones) and the resulting map is embedded below, can be viewed and edited on Google, is on Greenwich.co.uk's site and that of Charlton Champion.


View Greenwich & Blackheath gritting: location of salt bins in a larger map

I'm very pleased with how it's turned out - it was nice to collaborate with someone local to create something that we hope others will find useful, if nothing else it reminds people that we can use data in interesting ways to benefit the local community. It would be nice to think that it might get used to de-ice the pavements though, and of course the next phase of the project is to find a shovel and get out there to my nearest salt bin and get shovelling.

Areas listed below in orange are mapped - instructions on how to edit are further below.

Eltham
CASTLEWOOD DRIVE BETWEEN 68 AND 70
WESTMOUNT ROAD OUTSIDE 118 (SHOPS)
WESTMOUNT ROAD OUTSIDE 148 (SHOPS)
ROCHESTER WAY JUNCTION OF GLENESK (NORTH) UNDER FOOTBRIDGE
COURT ROAD (SHOPS) JUNCTION OF PORCUPINE CLOSE
THE MOUND OUTSIDE LIBRARY WILLIAM BAREFOOT DRIVE
WILLIAM BAREFOOT DRIVE OUTSIDE 77/79
FOOTSCRAY ROAD OUTSIDE 404 SHOPS
FOOTSCRAY ROAD FRONT OF LIBRARY
FOOTSCRAY ROAD SHOPS OPPOSITE BEEHIVE PUB J/O BLANMERLE ROAD
FOOTSCRAY RD J/W BLANMERLE
FOOTSCRAY ROAD OUTSIDE SCHOOL OPPOSITE 327
BEXLEY SERVICE ROAD ON RAMP AWAY FROM TELEPHONE BOX OPP SHOPS
cannot find 'Bexley Service Road'
GREENHITHE CLOSE JUNCTION OF HAMBLEDOWN ROAD
NEWMARKET GREEN S/O P.O
SIBTHORPE ROAD OPPOSITE P.O
LYME FARM ROAD J/O WEIGALL ROAD
CRAITHIE ROAD J/O STRATHAVEN ROAD
HORN PARK LANE J/O UPWOOD ROAD
RYLAND CRES OPP 19 - it's Ryelands!
ALNWICK ROAD O/S SCHOOL
KINGS ORCHARD OP BOB HOPE THEATRE
ROCHESTER WAY ALLEY TO DUMBRECK
COURT ROAD J/O WOODMERE
ARCHERY ROAD J/O STATION APPROACH PATH
ALLENSWOOD ROAD NR J/O DUNBLANE ROAD
HEATHERBANK S/O 13A
GLENLEA S/O GLENHOUSE
GLENLEA S/O BEECHHILL
GLENLEA S/O BALKASKIE
OAKWAYS S/O 28
WEST HALLOWES 39
SPEKE HILL J/O BUCKLER GARDENS
CROCKHAM WAY OPP 10
HEVERCROFT 18
BROWNSPRINGS J/O DOMONIC DRIVE

Greenwich
FRANCES STREET, JUNCTION OF SAMUEL STREET (BOTTOM END)
FRANCES STREET, S/O L/C 17, JUNCTION OF SAMUEL STREET (TOP END)
FRANCES STREET O/S FLATS 289-393
SAMUEL STREET, OPPOSITE 118
ARTILLERY PLACE J/W REPOSITORY ROAD
WOOLWICH CHURCH STREET J/O CHURCH HILL
FERRY APPROACH, LB NEWHAM SIDE, S/O RAMP
CHARLTON LANE, OPPOSITE LANSDOWNE LANE
THE HEIGHTS, OPP 2
FLETCHING ROAD, OPPOSITE LANSDOWNE LANE R/O COOP
CHARLTON CHURCH LANE, JUNCTION OF THE VILLAGE
CHARLTON CHURCH LANE, OPPOSITE WELLINGTON GARDENS
HUMBER ROAD J/O DINSDALE ROAD PART WAYDOWN HILL
HALSTOW ROAD ON BRIDGE, JUNCTION OF HUMBER ROAD
STRATHEDEN ROAD S/O THE STANDARD PUB
BEACONSFIELD ROAD, JUNCTION OF BEACONSFIELD CLOSE
HYDE VALE, O/S NO 56
POINT HILL, JUNCTION OF WESTGROVE LANE
POINT HILL, JUNCTION OF WINFORTON STREET
CHARLTON ROAD, O/S SHOPS
CHARLTON ROAD, ON BRIDGE OVER BTSA
CHARLTON BROAD, TOP OF WESTCOMBE HILL
OLD DOVER ROAD S/O CHIP SHOP
PROSPECT VALE OPP 71 ON REDMAC FOOTWAY
INVICTA ROAD OPP 22 ON CONCRETE VERGE
RUSTON ROAD S/O POST BOX REAR OF FOOTWAY
VANBRUGH HILL OPP ANNANDALE ROAD ON WIDE FOOTWAY
RIDEOUT STREET IN CORNER ON BEND
CORELLI ROAD ON TARMAC VERGE OPP 48
WYNDCLIFFE ROAD OPP 26 IN FRONT OF GUARD RAIL
MAIDENSTONE HILL OPP DABIN CRESCENT
MAIDENSTONE HILL IN FRONT OF HEDGE OPP 14
KINVEACHY GARDENS J/O WOODLAND TERRACE
THORNTREE ROAD S/O 20
THORNTREE ROAD S/O LC 12 - one marker given for both 20 and 12
BRAMSHOT AVE JNC OF EASTCOMBER AVE

Woolwich
MOORDOWN J/W CONSTITUTION RISE
DONALDSON JUNCTION OF MOORDOWN ON ROUNDABOUT
MOORDOWN JUNCTION OF CONDOVER ON ROUNDABOUT
MOORDOWN JUNCTION OF ANKERDOWN ON ROUNDABOUT
EGLINTON HILL JUNCTION OF SHREWSBURY LANE S/O 93
EGLINTON HILL JUNCTION OF BRENT ROAD LINE UP WITH L/C
PLUM LANE OPPOSITE ROWTON ROAD
SHREWSBURY LANE JUNCTION OF OCCUPATION LANE
KENILWORTH GARDENS JUNCTION OF CROWNWOODS LANE
SANDY HILL ROAD JUNCTION OF CRESCENT ROAD
DURHAM RISE S/O WAVERLEY ROAD
GOSSAGE ROAD J/O GRIFFEN ROAD O/S FLATS
BUNTON ST S/O RIVERSIDE HOUSE
MANTHORPE ROAD JUNCTION OF VICARAGE PARK
DALLIN ROAD (TOP OF STEPS) S/O 45 - 47
NITHDALE ROAD (TOP OF STEPS) S/O 39 - 41
SLADEDALE ROAD NEAR JUNCTION OF LAKEDALE ROAD
BOSTALL HILL JUNCTION OF HOWARTH ROAD
BOSTALL HILL JUNCTION OF ROCHDALE ROAD
BOSTALL HILL J/O BOSTALL LANE
BOSTALL HILL ON BROW L.H.S
BEXLEY & GREENWICH HOSPICE
VIEWLANDS ROAD O/S 26
MASON HILL/ANGLESEA KERB SIDE
ELMDENE/BIGNELL S/O 19 BIGNELL
ELMDENE/WILLENHALL S/O ELMDENE COURT
CANTWELL/RIPON BACK OF PATH
CANTWELL/BRENT BY STEPS
CANTWELL/PAGET RISE S/O SNP LC 10
PLUM LANE /BRIINLOW (SOUTH) S/O SNP
PLUM LANE/BRINKLOW (NORTH) BETWEEN LC & BOLLARD O/S 3
DALLIN ROAD S/O 45
DALILIN ROAD /MAYPLACE LANE S/0 LC 4
NITHDALE/MAYPLACE LANE BY SUB STATION KERB SIDE
GENESTA / MAYPLACE LANE S/O 1 BY LC
GENESTA /WROTTESLEY S/O LC BY SNP
GENESTA VERNHAM S/O 75 VERNHAM
PLUM LANE/GENESTA O/S SCHOOL
ROWTON/ADMASTON S/O SNP COMMON SIDE
HINSTOCK/OVERTON S/O 33
UPTON/ENNIS BY RAILINGS
PALMERSTON/PLUM LANE S/O 43
BRAMBLEBURY/HEAVITREE LC 9
MAJENDI S/O 1
BREWERY ROAD/CHESTNUT RIASE BY POST BOX BACK OF PATH
PARKDALE S/O 98 BY SUB STATION
TORMOUNT.OLD MILL ROAD O/S CHURCH HALL
PARKDALE /SLADEDALE S/O 67
LAKEDALE/TEWSON O/S 137 BY WALL
PLUMSTEAD HIGH STREET/KENTMERE S/O 121
PLUMSTEAD HIGH STREET/BARTH ROAD S/O 141
PLUMSTEAD HIGH STREET/ BANNOCKBURN S/O SCHOOL
RIVERDALE/SAUNDERS S/O SNP
TYMOUTH/RIVERDALE O/S 58
WINNS COMMON / RIVERDALE S/O SNP COMMON SIDE
WINNS COMMON / PURRETT BY SNP
ROCHDALE / BOSTALL HILL
BOSTALL LANE / BOSTALL HILL
ROCKMOUNT / GROSMOUNT S/O SNP
HEATHFIELD / BASSANT S/O LC 1
GILBOURN / BASSANT S/O SNP
WARLAND / WELTON S/O LC 24

How to edit Google maps - you will need a Google account to do this
1. Open the link to the Greenwich grit map
2. Open in a new tab or window another version of Google maps so that you can search for roads without disturbing the map you're editing.
3. Check that someone hasn't already done the road you've picked by using Ctrl+F to find its name in the list (note that there is a PAGE 2 as well!), if it's not there, proceed :)
[Until I get around to re-ordering them, the most recently added is at the bottom]
4. Find the location of the road (and the relevant junction if appropriate) in the spare Google maps page, then in the grit map page use the zoom in / out buttons and grab and drag the map image to bring the relevant area into the viewing panel.
5. Click on Edit (which is at the top of the list of roads added, in the left hand side panel. A small panel of icons will appear, click on the blue placer mark icon to launch a floating marker which will follow your mouse.
6. Position the x part of the marker where the bin is located, wait for the little dialogue box to appear and place whatever Greenwich Council has labelled this bin in the larger window, writing a title in the top,
eg.
Bostall Hill / Howarth Road
BOSTALL HILL JUNCTION OF HOWARTH ROAD
7. Press Save and continue to add more if you're inspired, otherwise press Done.
8. Thank you :)