Skip to content

Kentucky, like many states, maintains a historical marker database(KHMD). Scraping the database yielded 2226 total markers which were plotted to the center of the county located.

License

Notifications You must be signed in to change notification settings

RobWiederstein/ky_hist_markers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kentucky's Historical Markers


map of kentucky See article.

About the Project

Kentucky maintains a historical marker database(KHMD). This project is in two discrete parts: the building of a dataframe for the map markers and the display of the markers on a leaflet map.

The KHMD fields are not assigned separate html containers so the effort transformed from web scraping (rvest) to a regex (stringr) exercise. Or, in other words, it was a jumbled mess. However, the information is both extensive and informative. The primary constraint for the mapping of Kentucky’s historic markers was the lack of coordinates.

Scraping the database yielded 2226 total markers. The markers are numbered between 1 and 2,610. There are 412 that are not included in the database for whatever reason, including poor execution on my part. The database did have the county where the markers are located so the center of each county was computed and the markers were assigned there.

For most counties that worked pretty well. For example, the center of Jefferson County is Louisville and locating the markers there worked well. However, they were stacked on top of each other. Jefferson County has 228 markers.

With 228 markers assigned the same coordinates, the "pop-up" contents were not easily viewed. A minimal amout of random noise was introduced ("jitter") so the pop-up contents could be displayed. This ended up with markers placed on the top of strip malls and car dealerships. The map tiles were changed to Stamen so that building outlines were excluded.

Built With

Prerequisites

The header code must reference jquery, leaflet and leaflet market-cluster. Leaflet, mentioned above, has excellent documentation. Crucial for the markers to cluster on the Stamen map are the following lines of code added to the header of the webpage:

<!--stylesheets load first-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/MarkerCluster.Default.css" />
<!--scripts load next-->
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.6.0/leaflet.js"></script>
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/leaflet.markercluster/1.4.1/leaflet.markercluster.js'></script>
<script type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-providers/1.9.1/leaflet-providers.min.js"></script>

Dependencies

Kentucky counties were added as a layer to the map from the Kentucky Open GIS portal. An API for the full geojson feature collection is available here.

Installation


#install.packages("devtools")
devtools::install_github("RobWiederstein/my_functions")

#customize
git init
git clone https://github.com/RobWiederstein/my_functions.git

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Rob Wiederstein @RobWiederstein - khuon68@gmail.com

Project Link: https://github.com/RobWiederstein/covid-19-ky

Acknowledgements

About

Kentucky, like many states, maintains a historical marker database(KHMD). Scraping the database yielded 2226 total markers which were plotted to the center of the county located.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages