Wednesday, July 31, 2019

The Map of English Literature


The Map of English Literature shows the birthplaces of some of English Literature's greatest writers. On the map authors, poets and dramatists have been mapped to their place of birth (although there are a few exceptions where writers have been mapped to locations which they are more commonly associated with).

If you hover over a name on the map you can read more about the chosen writer. All this biographical information comes from each writer's Wikipedia entry. The map is not intended to be an exhaustive list of British writers. In fact I made the map mainly to explore how The Pudding made their map A People Map of the USA.

The Pudding's map (and my Map of English Literature) both use Mapbox GL. Mapbox Studio allows you to add GeoJSON data to a map as a layer. This has one great advantage if you want to add place-label names to a map. If you add your labels to the map as a layer in Mapbox Studio then Mapbox will automatically handle how that data is displayed. You therefore don't need to worry about your labels overlapping / colliding as Mapbox will do all the heavy work for you.

When I first played with The Pudding's map I realized that you could also still access all the GeoJSON data from your added layer. This means that when you hover over a name on the People Map of the USA you can read a short biography of the selected person. This achieved in Mapbox GL JS by using queryRenderedFeatures to access the properties of hovered-over map elements.

If you hover over an author name on the Map of English Literature the map queries that layer and can access all the GeoJSON data associated with that author. In this way when you hover over an author's name the map can display the writer's date of birth, where they were born and some brief biographical information.

If you want to see how I used queryrenderedfeatures in the Map of English Literature you can explore my code here.

No comments:

Post a Comment