Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mayutanaka
Copy link

No description provided.

/* =====================
Fill out this function definition
===================== */
$.ajax(phillySolarInstallationDataUrl).done(function(data){ myData = JSON.parse(data); });

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

Copy link
Author

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.

Copy link
Member

@rossbernet rossbernet left a 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) {
Copy link
Member

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);
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants