Skip to content

Commit

Permalink
Fixed the point plotter. Just small error actually! Just need to make…
Browse files Browse the repository at this point in the history
… sure you're using the map variable you defined outside of the init function. Notice, that you created another map variable inside the init function.
  • Loading branch information
rjm11010 committed Jan 10, 2017
1 parent 54a5c83 commit b5eeccf
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
12 changes: 8 additions & 4 deletions Main.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<style>
#map-canvas {
height: 100%
height: 100%
}

#slider {
Expand All @@ -28,20 +28,24 @@
</head>

<body>
<!-- Control Panel -->
<div class="col-xs-4">
<h1>GPS Plotter</h1>
<h5>Upload a CSV File:</h5>
<input type="file" id="csv-file" name="files"/>
<script src="Parser.js"></script>
<h5 id="sliderHeading" style="margin-top:30px"></h5>
<div id="slider">
<script src="Slider.js"></script>
</div>
</div>

<!-- Map Area -->
<div id="map-canvas" class="col-xs-8">
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB7kbzCC9vv9yxONLqYlravPF2tBW-HTuE&callback=initMap" async defer></script>
<script src="MapScript.js"></script>
</div>

</body>

<script src="MapScript.js"></script>
<script src="Parser.js"></script>
<script src="Slider.js"></script>
</html>
3 changes: 1 addition & 2 deletions MapScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var map;
var myLocation = {lat: 41.8077, lng: -72.2540};

function initMap() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 13,
center: myLocation,
rotateControl: true
Expand All @@ -20,7 +20,6 @@ function addMarker(lt, ln, prov)
{
// Troubleshooting call:
//console.log("Latitude: " + lt + ". Longitude: " + ln);

var location = new google.maps.LatLng(lt, ln);
var marker = new google.maps.Marker({
position: location,
Expand Down
9 changes: 6 additions & 3 deletions Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ var data;
function handleFile(evt) {

var file = evt.target.files[0];
console.log(file);

Papa.parse(file, {
header: true,
dynamicTyping: true,
complete: function(results)
complete: function(results)
{
data = results;
console.log(results.data);
Expand All @@ -24,11 +25,13 @@ function addMarkers(data)
var lat = data.data[i].latitude;
var lon = data.data[i].longitude;
var prov = data.data[i].Provider;
addMarker(lat, lon, prov);
if (lat !== undefined & lon !== undefined) {
addMarker(lat, lon, prov);
}
}
}

/* Troubleshooting Function
/* Troubleshooting Function
function showLatLang(lat, lon)
{
console.log("Latitude: " + lat + ". Longitude: " + lon);
Expand Down
13 changes: 7 additions & 6 deletions Slider.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
function addSlider(fileData) {
var minDate = new Date(fileData.data[0].local_time);
var maxDate = new Date(fileData.data[data.data.length - 1].local_time);

var minDate = new Date(parseInt(fileData.data[0].senseStartTimeMillis));
var maxDate = new Date(parseInt(fileData.data[data.data.length - 2].senseStartTimeMillis));
console.log(minDate);
console.log(maxDate);
$("#slider").dateRangeSlider({

arrows: false,

bounds: {
min: minDate,
min: minDate,
max: maxDate
},

defaultValues: {
min: minDate,
min: minDate,
max: maxDate
}
});
Expand Down

0 comments on commit b5eeccf

Please sign in to comment.