livienyin/lexvlex — pull request #3 by lyzidiamond (2014-06-06 22:04:55+00:00)
Title: Leaflet map!

A more verbose list of what I did here:

- Included links in index.html to leaflet.js, jquery.js, parks_map.js. parks-map includes all the code for the map.
- Made a map, gave it some settings, defined some basemap tiles, added tiles to the map.
- Made an object of key-value pairs to translate geojson keys to verbose keys (e.g. biggest_park to Biggest Park)
- Loaded census tracts from the census_tracts.geojson file using jQuery's getJSON method, created a Leaflet GeoJSON object with the data, and added that object to the map.
- Defined a function for styling the polygons in the GeoJSON object.
- Added a style option -- tracts without parks are gray.
- Defined a function popup to house the text of the popups on each polygon.
- Set that function to return popupText.
- Defined a function onEachFeature that will bind functionality to each feature. Had it bind popups to each feature.
- Added an event handler such that clicking on a feature will zoom to it.
- Added CSS for the map div (it needs a height value, otherwise it won't show up)

More to come, but see what you think of this part. Apologies for any errors I didn't catch.