tog22 / eahub

EA Hub
7 stars 1 forks source link

Fix the missing map from EA groups page #18

Closed haryshwaran closed 9 years ago

haryshwaran commented 9 years ago

The groups tagged on the map are visible but the map itself is missing showing only a grey Background.

tog22 commented 9 years ago

Everything about the map is in (or accessible via Javascript linked from) the HTML source of the pages it's on, e.g. http://effectivealtruismhub.com/map (and http://effectivealtruismhub.com/groups and http://effectivealtruismhub.com/ ). So you can fix it with a local copy of that. The map points included in that HTML source are generated elsewhere, but you don't need to worry about that.

(Currently they're generated at ea...hub dot com /sites/effectivealtruismhub.com/scripts/map-exports/ea-profiles.php pending someone taking on https://github.com/tog22/eahub/issues/17 .)

haryshwaran commented 9 years ago

The Map tiles returned 404s from Mapbox which is why they were greyed out. A new Map box account was created to replace the tile provider for leaflet.js. The map now displays properly at the dev site.

tog22 commented 9 years ago

Deployed fix by @haryshwaran which was to paste in this code:

L.tileLayer('https://api.tiles.mapbox.com/v4/shared-ea-account.ee9fbb54/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoic2hhcmVkLWVhLWFjY291bnQiLCJhIjoiM2M3YjdmNzcwNDg1MmM5YjliMzIyNThkZTc2OWJjMWUifQ.-QAdcCLKxJZr8dtAofvdsw',{
       maxZoom: 18,
       attribution:
                    'Imagery from <a href="http://mapbox.com/about/maps/">MapBox</a> &mdash; ' +
                    'Map data {attribution.OpenStreetMap}',
       subdomains: 'abcd'         
     }).addTo(map);
haryshwaran commented 9 years ago

attributions need to be fixed and subdomains can be removed, please use this code instead of the above one.

L.tileLayer('https://api.tiles.mapbox.com/v4/shared-ea-account.ee9fbb54/{z}/{x}/{y}.png?access_token=pk.eyJ1Ijoic2hhcmVkLWVhLWFjY291bnQiLCJhIjoiM2M3YjdmNzcwNDg1MmM5YjliMzIyNThkZTc2OWJjMWUifQ.-QAdcCLKxJZr8dtAofvdsw',{
       maxZoom: 18,
       attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
                    '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
                    'Imagery &copy <a href="http://mapbox.com">Mapbox</a>'
     }).addTo(map);
haryshwaran commented 9 years ago

code added to all pages and attributions has been fixed

OAGr commented 9 years ago

:+1: