mysociety / whatdotheyknow-theme

The Alaveteli theme for WhatDoTheyKnow (UK)
http://www.whatdotheyknow.com/
MIT License
31 stars 26 forks source link

If a body is tagged with a MapIt ID then show a map of the area covered by the body #818

Open RichardTaylor opened 3 years ago

RichardTaylor commented 3 years ago

eg. if

https://www.whatdotheyknow.com/body/herefordshire_and_worcestershire_ccg

was tagged

mapit:163965

show a map of the area covered by the CCG on the CCG page.

https://mapit.mysociety.org/area/163965.html

map-on-page

Related: https://github.com/mysociety/alaveteli/issues/235 and https://github.com/mysociety/whatdotheyknow-theme/issues/579

mdeuk commented 3 years ago

I love this idea - the example you've given is one that'd also work extremely well for Councils, particularly as we look to improve our coverage of Town and Parish councils, where knowing the particular locus can be really, really helpful!

mdeuk commented 3 years ago

Just to add, I can see this also being very helpful for our regional pages - the enhanced metadata could allow for a more enriched experience to be generated there with less overall work, and it could also allow for better targetting of pro user requests (as an example: you might wish to make a FOI request to schools in a given local authority area, or to NHS trusts [bearing in mind there is often more than one]).

416 #715 #716 #717 #747

garethrees commented 3 years ago

Just linking to an email thread about the Mapit aspect of this.

There's no embed option in Mapit, but would be relatively easy to render by the sounds of things:

// The minimal HTML you'd need to replicate the map on WDTK would be
// something like: add the Leaflet CSS to the head of the page, and the
// Leaflet JS to the bottom, stick a <div id="map"></div> in the HTML
// with some styling to give it a width/height, then have a bit of extra
// JavaScript that does the same as MapIt to plot the area:

// Set up map with OSM background mapping
var map = new L.Map("leaflet");
map.attributionControl.setPrefix('');
var osm = new
  L.TileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    attribution: 'Map © <a
    href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>
    contributors',
    maxZoom: 18
  });
map.addLayer(osm);

// Fetch the GeoJSON of the area and add it to the map
var mapit = mapit || {};
mapit.area_loaded = function(data) {
  var area = new L.GeoJSON(data);
  // Leaflet double click on an area doesn't work by default
  area.on('dblclick', function(e){
    var z = map.getZoom() + (e.originalEvent.shiftKey ? -1 : 1);
    map.setZoomAround(e.containerPoint, z);
  });
  mapit.areas.addLayer(area);
  map.fitBounds(mapit.areas.getBounds());
};
mapit.areas = L.featureGroup().addTo(map);
reqwest({
  url: 'https://mapit.mysociety.org/area/163965.geojson?simplify_tolerance=0.0001',
  type: 'json',
  success: mapit.area_loaded
});
RichardTaylor commented 2 years ago

Linking to the ticket: Show maps of coverage areas for regional water and sewerage companies #904

RichardTaylor commented 2 years ago

Maps would improve accessibility of the service helping us serve those who are not aware of, or easily able to research, relevant administrative boundaries.

Maps might help ensure requests are directed to the correct body.

Adding more geographical information might underpin geographical based features in the future eg. alerts for requests relating to a particular area or showing bodies which cover a particular area. https://github.com/mysociety/alaveteli/issues/235

mdeuk commented 2 years ago

Maps would improve accessibility of the service helping us serve those who are not aware of, or easily able to research, relevant administrative boundaries.

A rather similar scenario, which I've just described to volunteers@ would be the listing of schools within a particular geographic area. Richard and William have been doing excellent work adding schools to the database, so this would be complimentary.

Linking this with #908 would allow us to present a listing of bodies, say schools by type, within a relevant geography (say, at Country level, then County or City and so on).

This would also allow us to present the Scottish example, whereby the majority of schools [1] are under local authority control, and therefore we direct FoISA / EI(S)R requests to the local authority, as they are the relevant public body.

[1] The exception being those with "grant-aided" or "independent special school" status, which are public bodies in their own right, and are explicitly covered under FoISA; and the "independent" (private) schools which aren't included (but, maybe they should be?).

RichardTaylor commented 2 years ago

Map data appears to be available for Areas of Outstanding Natural Beauty

https://github.com/mysociety/whatdotheyknow-theme/issues/988#issuecomment-1040502185

and National Parks

https://naturalengland-defra.opendata.arcgis.com/datasets/d333c7529754444894e2d7f5044d1bbf/explore

We list, or want to list, the boards which run the Areas of Outstanding Natural Beauty and National Park Authorities.

Maps showing the scope of these areas would help users.

RichardTaylor commented 2 years ago

Linking mysociety/mapit.mysociety.org#135

RichardTaylor commented 2 years ago

It would be great if we could have a map on a category page where all the bodies cover different areas eg.

https://www.whatdotheyknow.com/body/list/nhs111

as well as maps on individual bodies.

We could also use maps to show where we're missing email addresses for bodies, which could help gamify finding them.

FOIMonkey commented 2 years ago

If embedding maps is currently too hard, for now, we could link to the MapIt page from the sidebar on the body page, where we link to the data protection/charity registration.

This looks pretty trivial to do, unless the tags also need defining somewhere other than at https://github.com/mysociety/whatdotheyknow-theme/blob/master/lib/views/public_body/_more_info.html.erb

I have tagged all the IOW parish councils with the correct MapIt id number to allow us to experiment.

FOIMonkey commented 2 years ago

I've tagged all councils with the correct MapIt ID number in the form. mapit:id eg

mapit:152125 -> https://mapit.mysociety.org/area/152125.html

We should be able to at least link to maps of council areas now.

FOIMonkey commented 2 years ago

I've not done the combined authorities, because I couldn't figure out how they were labelled. If anyone knows, there is a spreadsheet called rosetta stone on the drive that links up various bits of mySoc data, so please add them to there.

FOIMonkey commented 2 years ago

I've tagged 5949 parish and community councils with the correct MapIt id. I've also tagged these with the mapit id of the parent district council in the form of parent_mapit:id eg

parent_mapit:2595 -> https://mapit.mysociety.org/area/2595.html

This has the beneficial side effect of being able to view parish listings by district eg:

https://www.whatdotheyknow.com/body?tag=parent_mapit%3A2595

garethrees commented 2 years ago

Spiked a quick improvement to make these a bit more usable for users https://github.com/mysociety/whatdotheyknow-theme/pull/1330.