Skip to content

Commit

Permalink
adding new dataset features to map
Browse files Browse the repository at this point in the history
  • Loading branch information
dmvieira committed Apr 1, 2024
1 parent 3ee2c47 commit 22e9a18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Get Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
" food.append(snack.strip())\n",
" food_desc.append(snack_details.strip())\n",
" contact.append(phone.strip())\n",
" work_hours.append(work.strip())\n",
" work_hours.append(work.strip().replace('hQ', 'h | Q').replace('hT', 'h | T').replace('hS', 'h | S').replace('hD', 'h | D'))\n",
" else:\n",
" continue\n",
" print(f\"foi página {i}\")\n",
Expand Down
17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ function initMap(position) {
.then(function(places){
for (var i in places) {
var place = places[i];
createMarker(place.name, place.geo, place.url, place.food, place.food_desc);
createMarker(
place.name, place.geo, place.url, place.food, place.food_desc, place.work_hours, place.contact);
}
})

Expand All @@ -39,15 +40,25 @@ function checkAndInit(){
}
}

function createMarker(name, geo, url, food, foodDesc) {
function createMarker(name, geo, url, food, foodDesc, workHours, contact) {

var marker = new google.maps.Marker({
map,
position: geo,
title: name
});
var message = "<h3><a href='"+url+"' target='_blank'>"+name+"</a></h3><p><strong>"+food+"</strong><br />"+foodDesc+"</p>";

if (workHours !== ''){
message += "<p><br /><br />"+workHours+"</p>"
}

if (contact !== ''){
message += "<p><br /><br />"+contact+"</p>"
}

var infowindow = new google.maps.InfoWindow({
content: "<h3><a href='"+url+"' target='_blank'>"+name+"</a></h3><p><strong>"+food+"</strong><br />"+foodDesc+"</p>"
content: message
});
marker.addListener('click', function() {
infowindow.open(map, marker);
Expand Down
2 changes: 1 addition & 1 deletion places.json

Large diffs are not rendered by default.

0 comments on commit 22e9a18

Please sign in to comment.