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
Binary file added a$$et$/flame_no_bg.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added a$$et$/godflame.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added a$$et$/skull.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
304 changes: 174 additions & 130 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,166 +1,210 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<head>
<meta charset="utf-8" />
<title>Land Use</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.css' rel='stylesheet' />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.js"></script>
<link
href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.43.0/mapbox-gl.css"
rel="stylesheet"
/>
<style>
body {
margin:0;
padding:0;
font-family: sans-serif;
font-size: 14px; }
#map { position:absolute; top:0; bottom:0; width:100%; }
body {
margin: 0;
padding: 0;
font-family: sans-serif;
font-size: 14px;
}
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
li {
padding: 3px 0;}
#panel{
background: white;
width: 400px;
border: 1px solid rgba(0,0,0,0.05);
padding: 3px 0;
}
#panel {
background: white;
width: 400px;
border: 1px solid rgba(0, 0, 0, 0.05);
position: absolute;
right: 16px;
top: 16px;
box-shadow: 0 0 4px 0 rgba(0,0,0,0.1);
color: rgba(0,0,0, 0.5);

box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
color: rgba(0, 0, 0, 0.5);
}
h4 {
text-transform: uppercase;
border-bottom: 1px solid rgba(0,0,0,0.05);
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
margin: 0;
padding: 16px;
}
ul{
list-style-type: none;
margin: 0;
ul {
list-style-type: none;
margin: 0;
padding: 16px;

}
ul span {
width: 10px;
height: 10px;
display: inline-block;
margin-right: 8px;
border-radius: 50%;
}
border-radius: 50%;
}

dd{
margin-left: 0;
margin-bottom: 8px;
font-weight: bold;
}
.mapboxgl-popup-content{
font-size: 14px;
color: rgba(0,0,0, 0.5);
min-width: 250px;
max-width: 400px;
box-shadow: 0 0 4px 0 rgba(0,0,0,0.1);
}
dl{
margin-bottom: 0;
}

dd {
margin-left: 0;
margin-bottom: 8px;
font-weight: bold;
}
.mapboxgl-popup-content {
font-size: 14px;
color: rgba(0, 0, 0, 0.5);
min-width: 250px;
max-width: 400px;
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
}
dl {
margin-bottom: 0;
}
.flame {
background-image: url('./a$$et$/flame_no_bg.gif');
background-size: cover;
width: 50px;
height: 50px;
border-radius: 50%;
cursor: pointer;
z-index: 1000;
}
#godflame {
position: absolute;
bottom: 0;
left: 0;
pointer-events: none;
z-index: 1000;
height: 200px;
}
#skull {
position: absolute;
top: 0;
left: 10%;
z-index: 100;
}
</style>
</head>
<body>

<div id='map' ></div>
<div id="panel">
<h4>Land Use</h4>
<ul>
<li ><span style="background: #F9EDDB;"></span>One & Two Family Buildings</li>
<li><span style="background: #F6D9CB;"></span>Multi-Family Buildings</li>
<li><span style="background: #F1B89C;"></span>Mixed Residential & Commercial Buildings</li>
<li><span style="background: #DF7649;"></span>Commercial & Office Buildings</li>
<li><span style="background: #CF4F4F;"></span>Industrial & Manufacturing</li>
<li><span style="background: #BEC6CC;"></span>Transportation & Utility</li>
<li><span style="background: #BDE7F4;"></span>Public Facilities & Institutions</li>
<li><span style="background: #A3D393;"></span>Open Space & Outdoor Recreation</li>
<li><span style="background: #8DA2B4;"></span>Parking Facilities</li>
<li><span style="background: #E4E4E4;"></span>Vacant Land</li>
<li><span style="background: #F9F9F9; border: 1px solid #ccc; box-sizing: border-box;" ></span>No Data</li>
</ul>
</div>
<script>
</head>
<body>
<div id="map"></div>
<image id="godflame" src="./a$$et$/godflame.gif" />
<image id="skull" src="./a$$et$/skull.gif" />
<div id="panel">
<h4>Land Use</h4>
<ul>
<li>
<span style="background: #f9eddb"></span>One & Two Family Buildings
</li>
<li><span style="background: #f6d9cb"></span>Multi-Family Buildings</li>
<li>
<span style="background: #f1b89c"></span>Mixed Residential &
Commercial Buildings
</li>
<li>
<span style="background: #df7649"></span>Commercial & Office Buildings
</li>
<li>
<span style="background: #cf4f4f"></span>Industrial & Manufacturing
</li>
<li>
<span style="background: #bec6cc"></span>Transportation & Utility
</li>
<li>
<span style="background: #bde7f4"></span>Public Facilities &
Institutions
</li>
<li>
<span style="background: #a3d393"></span>Open Space & Outdoor
Recreation
</li>
<li><span style="background: #8da2b4"></span>Parking Facilities</li>
<li><span style="background: #e4e4e4"></span>Vacant Land</li>
<li>
<span
style="
background: #f9f9f9;
border: 1px solid #ccc;
box-sizing: border-box;
"
></span
>No Data
</li>
</ul>
</div>
<script>
var landUseNames = {
'01': 'One & Two Family Buildings',
'02': 'Multi-Family Walk-Up Buildings',
'03': 'Multi-Family Elevator Buildings',
'04': 'Mixed Residential & Commercial Buildings',
'05': 'Commercial & Office Buildings',
'06': 'Industrial & Manufacturing',
'07': 'Transportation & Utility',
'08': 'Public Facilities & Institutions',
'09': 'Open Space & Outdoor Recreation',
'10': 'Parking Facilities',
'11': 'Vacant Land'
};
mapboxgl.accessToken = 'pk.eyJ1IjoianF1YW50eiIsImEiOiJjamM5bGZ4NmEwMGRzMndsbGZsYmwwejVwIn0.ntpYs5_qxmAkg4MBA7ue7A';
var map = new mapboxgl.Map({
'01': 'One & Two Family Buildings',
'02': 'Multi-Family Walk-Up Buildings',
'03': 'Multi-Family Elevator Buildings',
'04': 'Mixed Residential & Commercial Buildings',
'05': 'Commercial & Office Buildings',
'06': 'Industrial & Manufacturing',
'07': 'Transportation & Utility',
'08': 'Public Facilities & Institutions',
'09': 'Open Space & Outdoor Recreation',
10: 'Parking Facilities',
11: 'Vacant Land',
};
mapboxgl.accessToken =
'pk.eyJ1IjoianF1YW50eiIsImEiOiJjamM5bGZ4NmEwMGRzMndsbGZsYmwwejVwIn0.ntpYs5_qxmAkg4MBA7ue7A';
var map = new mapboxgl.Map({
container: 'map', // container id
style: 'mapbox://styles/jquantz/cjcif3khv0bwt2rob19kywvex', // stylesheet location
center: [-73.987,40.719], // starting position [lng, lat]
center: [-73.987, 40.719], // starting position [lng, lat]
zoom: 13,
minZoom: 13,
maxZoom: 18 // starting zoom
});
var nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'top-left');

map.on('mousemove', function(event) {
if (map.loaded()) {
var features = map.queryRenderedFeatures(event.point, {layers: ['lots']
});
maxZoom: 18, // starting zoom
});
var nav = new mapboxgl.NavigationControl();
map.addControl(nav, 'top-left');

map.getCanvas().style.cursor = features.length ? 'pointer' : '';
}
});
map.on('mousemove', function (event) {
if (map.loaded()) {
var features = map.queryRenderedFeatures(event.point, {
layers: ['lots'],
});

map.on('click', function(event) {
console.log('Mouse Clicked');
console.log(event.point);
map.getCanvas().style.cursor = features.length ? 'pointer' : '';
}
});

var geometry = event.point;
var parameters = {
layers:['lots']
};
map.on('click', (ev) => {
console.log(ev.originalEvent.target.className);

var features = map.queryRenderedFeatures(geometry, parameters);
//console.log(features);
//console.log(features.length + ' features');
var lot = features[0];
console.log(lot);
if (ev.originalEvent.target.className === 'mapboxgl-canvas') {
const flame = document.createElement('div');
flame.className = 'flame';

if (features.length > 0) {
var bbl = lot.properties.BBL || '—';
var landUse = landUseNames[lot.properties.LandUse] || '—';
var zoneDist = lot.properties.ZoneDist1 || '—';
var bldgClass = lot.properties.BldgClass || '—';
var ownerName = lot.properties.OwnerName || '—';
console.log(bbl, landUse, zoneDist, bldgClass, ownerName);
const godflame = document.getElementById('godflame');
godflame.style.top = `${ev.point.y - 100}px`;
godflame.style.left = `${(ev.point.x - 500, 0)}px`;

setTimeout(() => {
flame.remove();
}, 3000);

var popup = new mapboxgl.Popup()
.setLngLat(event.lngLat)
.setHTML('<dl>' +
'<dt>BBL</dt>' +
'<dd>' + bbl + '</dd>' +
'<dt>Land Use</dt>' +
'<dd>' + landUse + '</dd>' +
'<dt>Zoning District</dt>' +
'<dd>' + zoneDist + '</dd>' +
'<dt>Building Class</dt>' +
'<dd>' + bldgClass + '</dd>' +
'<dt>Owner</dt>' +
'<dd>' + ownerName + '</dd>' +
'</dl>')
.addTo(map);
}
});
</script>
flame.addEventListener('click', (ev) => {
console.log('flame extinguished');
flame.remove();
});

</body>
</html>
const marker = new mapboxgl.Marker(flame)
.setLngLat(ev.lngLat)
.addTo(map);
}
});
</script>
</body>
</html>