forked from kkingsbe/FltPlanGenerator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenstreetmappointtest.html
61 lines (58 loc) · 1.91 KB
/
openstreetmappointtest.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/css/ol.css" type="text/css">
<style>
.map {
height: 400px;
width: 100%;
}
</style>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<title>OpenLayers example</title>
</head>
<body>
<h2>My Map</h2>
<div id="map" class="map"></div>
<script type="text/javascript">
//Made with the help of https://medium.com/attentive-ai/working-with-openlayers-4-part-2-using-markers-or-points-on-the-map-f8e9b5cae098 and www.sqlitetutorial.net/sqlite-nodejs/query/
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-77.171889, 39.171843]),
zoom: 12
})
});
//var airportLonLats = loadAirports();
loadAirports();
var marker = new ol.Feature({
geometry: new ol.geom.Point(
ol.proj.fromLonLat([-77.171889, 39.171843])
),
});
var vectorSource = new ol.source.Vector({
features: [marker]
});
var markerVectorLayer = new ol.layer.Vector({
source: vectorSource,
});
map.addLayer(markerVectorLayer);
function loadAirports(){
const sqlite3 = require('sqlite3').verbose();
//open the database
let db = new sqlite3.Database('C:/Users/sking/PycharmProjects/FltPlanGenerator/waypoints.db');
let sql = 'SELECT * from Airports';
db.all(sql, function(err, rows){
rows.forEach(function (row){
console.log(row.long, row.lat);
})
})
}
</script>
</body>
</html>