-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HW4 - Mayu Tanaka #1
base: master
Are you sure you want to change the base?
Conversation
/* ===================== | ||
Fill out this function definition | ||
===================== */ | ||
$.ajax(phillySolarInstallationDataUrl).done(function(data){ myData = JSON.parse(data); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you access myData outside of the ajax wrapper? this doesn't seem to work when I do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to redefine phillySolarInstallationDataUrl in this file, but I was able to access myData as a global variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work.
var plotMarkers = function() {}; | ||
var downloadData = $.ajax("http://raw.githubusercontent.com/CPLN692-MUSA611/datasets/master/json/philadelphia-bike-crashes-snippet.json"); | ||
var parseData = function(url) { return JSON.parse(url); }; | ||
var makeMarkers = function(json) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var makeMarkers = function(json) {
// var markers = [];
markerArr = _.map(json, function(feature) {
return L.marker([feature.lat_final, feature.long_final]);
});
return markerArr;
Small improvement suggestion: using _.map
instead of _.each
, which creates the array and doesn't require the push
_.each(myData, function(feature) { | ||
var marker = L.marker([feature.LAT, feature.LONG_]).bindPopup(feature.NAME); | ||
if (booleanField && feature.YEARBUILT>2010) { | ||
marker = marker.setOpacity(0.25); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This opacity is a nice effect for the query results
No description provided.