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

HW2_SagariDatta #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions assignment/HW2_SagariDatta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<head>
<!--stylesheet imports-->
<link rel="stylesheet" href="leaflet.css" />
</head>
<body>
<!--left panel-->
<div style="position:fixed;left:0px;width:400px">
</div>
<!--map-->
<div id="map" style="position:fixed;right:0px;left:400px;height:100%;">
</div>

<!--javascript imports-->
<script src="leaflet.js"></script>
<script src="health_centers.js"></script>

<!--Your code starts here-->
<script>
var map = L.map('map', {
center: [39.9522, -75.1639],
zoom: 14
});
var Stamen_TonerLite = L.tileLayer('http://stamen-tiles-{s}.a.ssl.fastly.net/toner-lite/{z}/{x}/{y}.{ext}', {
attribution: 'Map tiles by <a href="http://stamen.com">Stamen Design</a>, <a href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a> &mdash; Map data &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
subdomains: 'abcd',
minZoom: 0,
maxZoom: 20,
ext: 'png'
}).addTo(map);
</script>
<script>
/* =====================

# Week 2 - Assignment

## Introduction

This week's assignment as having two separate parts:

1. Log a series of arrays to the console that represents the health_centers dataset
in array form. For example, [{'first': 1, 'second': 44}, {'first': 2, 'second': 12}]
becomes [['first','second'],[1, 44],[2, 12]]

2. Put a marker on the map for each health center in the specified lat/lng coordinates
with a popup (a simple text dialog) that shows that location's name when its marker
is clicked.

EXTRA: Some of these locations offer dental services as well. Can you find some way to
give dental locations a different icon? (Here's some relevant documentation:
http://leafletjs.com/reference.html#icon)

Remember: functions are meant to facilitate code comprehension and reuse. Try to
use them to organize your code.
===================== */


/* =====================

Start code

===================== */


for (var i; i < healthCenters.length; i = i + 1) {
print(healthCenters[i]);
}

var jsonToCsv = function(json) { console.log(json); };


var addMarkers = function(map) {
var marker1 = L.marker([39.955032, -75.202487]).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.

This looks like there is only one marker added.
There should be more.

};

/* =====================

End code

===================== */


jsonToCsv(healthCenters);
addMarkers(map);
</script>
<!--Your code ends here-->
</body>
</html>
2 changes: 2 additions & 0 deletions assignment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<script src="leaflet.js"></script>
<script src="health_centers.js"></script>

// trial change comment

<!--Your code starts here-->
<script>
var map = L.map('map', {
Expand Down