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-Zixuan Xu #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zxuanxu
Copy link

@zxuanxu zxuanxu commented Feb 12, 2019

No description provided.

};
var makeMarkers = function(parseData) {
var markers = [];
_.forEach(parseData, function(x){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small improvement suggestion: using _.map instead of _.each, which creates the array and doesn't require the push

/* =====================
Define a resetMap function to remove markers from the map and clear the array of markers
===================== */
var resetMap = function() {
var resetMap = function(myMarkers) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't get your resetMap() to work.

I think it's because myMarkers has undefined elements in, as per this screen shot:
image

I'm not exactly sure why you have undefineds in there because your conditional logic looks good to filter those out. But alas, it has undefined.

_.forEach(myData, function(x){
var marker;
if (booleanField && x["UCR Code"] == 600) {
marker = L.marker([x.Lat, x.Lng]).bindPopup(x["General Crime Category"]).addTo(map);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't requested clarifying comments before this HW was due... but for next time, it'd be helpful to have some comments to help understand what it is you are trying to filter here by so I could get a good idea from the outset without needing to understand all the logic.

But it looks good.

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.

2 participants