Skip to content
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
8 changes: 3 additions & 5 deletions css/leaflet.draw.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@
color: #FFF;
/* Trying different fonts
font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif; */
font: 11px/19px "Times New Roman", Times New Roman, Times New Roman, serif;
line-height: 28px;
font: 11px/19px "Times New Roman", Times New Roman, Times New Roman, serif; line-height: 28px;
text-decoration: none;
padding-left: 10px;
padding-right: 10px;
Expand Down Expand Up @@ -231,8 +230,7 @@
color: #fff;
/* Trying different fonts
font: 12px/18px "Helvetica Neue", Arial, Helvetica, sans-serif; */
font: 12px/18px "Times New Roman", Times New Roman, Times New Roman, serif;
margin-left: 20px;
font: 12px/18px "Times New Roman", Times New Roman, Times New Roman, serif; margin-left: 20px;
margin-top: -21px;
padding: 4px 8px;
position: absolute;
Expand Down Expand Up @@ -347,4 +345,4 @@
.leaflet-oldie .leaflet-draw-actions-top.leaflet-draw-actions-bottom a {
height: 27px;
line-height: 27px;
}
}
15 changes: 13 additions & 2 deletions css/styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#map {
width: 1024px;
height: 768px;
width: 100%;
height: 100%;
}
#slider-timestamp {
margin-top: 50px;
font-size: 15px;
line-height: 20px;
width: 180px;
padding-left: 20px;
}
.paramTitle {
color: red;
font-weight: bold;
}
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.ie.css" /><![endif]-->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" type="text/css">
<link rel="stylesheet" href="css/styles.css" />
</head>
<body>

<div id="map" style="width: 100%; height: 600px"></div>
<div id="map" style="width: 100%; height: 700px"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
Expand Down
21 changes: 13 additions & 8 deletions js/SliderControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ L.Control.SliderControl = L.Control.extend({

// Create a control sliderContainer with a jquery ui slider
var sliderContainer = L.DomUtil.create('div', 'slider', this._container);

$(sliderContainer).append('<div id="leaflet-slider" style="width:200px"><div class="ui-slider-handle"></div><div id="slider-timestamp" style="width:200px; margin-top:10px;background-color:#FFFFFF"></div></div>');

$(sliderContainer).append('<div id="leaflet-slider"><div class="ui-slider-handle"></div><div id="slider-timestamp" style="width:200px; background-color:#FFFFFF;"></div></div>');
//Prevent map panning/zooming while using the slider
$(sliderContainer).mousedown(function () {
map.dragging.disable();
Expand All @@ -45,6 +43,7 @@ L.Control.SliderControl = L.Control.extend({
map.dragging.enable();
//Only show the slider timestamp while using the slider
$('#slider-timestamp').html('');
$('#slider-timestamp').css('border','');
});

var options = this.options;
Expand Down Expand Up @@ -88,16 +87,16 @@ L.Control.SliderControl = L.Control.extend({
//If there is no startTime property, this line has to be removed (or exchanged with a different property)

var PrettyDate = new Date(options.markers[ui.value].feature.properties.startTime);

//PrettyDate.getMinutes() += '0' + PgetMinutes;
//PrettyDate.getMinutes() += '0' + PgetMinutes;
var PrettyString = "";
PrettyString += PrettyDate.getHours() + ":";
PrettyString += (PrettyDate.getMinutes() < 10) ? ("0" + PrettyDate.getMinutes()) : PrettyDate.getMinutes();

if(options.markers[ui.value].feature.properties.startTime){
if(options.markers[ui.value]) $('#slider-timestamp').html(PrettyString);
if(options.markers[ui.value]) $('#slider-timestamp').html('<p style="padding-top:5px;" class="paramTitle">Street Name:</p>' + options.markers[ui.value].feature.properties.streetName + '<p class="paramTitle">Closure Extent:</p>' + options.markers[ui.value].feature.properties.closureExtent + '<p class="paramTitle">Start Time:</p>' + PrettyString + '<p class="paramTitle">End Time:</p>' + options.markers[ui.value].feature.properties.endTime.substr(0, 19) + '<p></p>' );
$('#slider-timestamp').css('border','solid black');
}
console.log(options.range)
if(options.range){
for (var i = ui.values[0]; i< ui.values[1]; i++){
if(options.markers[i]) map.addLayer(options.markers[i]);
Expand All @@ -111,6 +110,12 @@ L.Control.SliderControl = L.Control.extend({
}else{
for (var i = options.minValue; i < ui.value ; i++) {
if(options.markers[i]) map.addLayer(options.markers[i]);
if(options.markers[i]) {
if(options.markers[i].feature.properties.endTime < options.markers[ui.value].feature.properties.startTime) {
if(options.markers[i - 1]) map.removeLayer(options.markers[i - 1]);
if(options.markers[31].feature.properties.endTime < options.markers[ui.value].feature.properties.startTime) map.removeLayer(options.markers[31]);
}
}
}
for (var i = ui.value; i <= options.maxValue; i++) {
if(options.markers[i]) map.removeLayer(options.markers[i]);
Expand Down
14 changes: 6 additions & 8 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ var map = L.map('map').setView([38.878432, -77.109218], 15);

app.load = function() {

L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
L.tileLayer('http://{s}.www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png', {
attribution: 'Map data © OpenStreetMap contributors',
maxZoom: 18
}).addTo(map);
$.getJSON("map.geojson", function(json) {
console.dir(json);
for( var i = 0; i < json.features.length; i++)
{
json.features[i];
}


console.dir(json);
for( var i = 0; i < json.features.length; i++)
{
json.features[i];
}
var testlayer = L.geoJson(json);
var sliderControl = L.control.sliderControl({
position: "topright",
Expand Down
6 changes: 3 additions & 3 deletions map.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@
"properties": {
"streetName": "19th Street North",
"closureExtent": "from Lynn Street to North Nash Street",
"startTime": "2013-10-27T08:00:00.000Z",
"endTime": "2013-10-27T21:30:00.000Z"
"startTime": "2013-10-28T08:00:00.000Z",
"endTime": "2013-10-29T21:30:00.000Z"
},
"geometry": {
"type": "LineString",
Expand Down Expand Up @@ -676,4 +676,4 @@
}
}
]
}
}