-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (33 loc) · 941 Bytes
/
script.js
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
const client = stitch.Stitch.initializeDefaultAppClient("patentreader-ticse");
const db = client
.getServiceClient(stitch.RemoteMongoClient.factory, "mongodb-atlas")
.db("Patents");
//const startingTownship = "022N - 002W";
const startingCounty = "Clinton";
const scale = 40;
AuthorizeAndFetchData(startingCounty);
function AuthorizeAndFetchData(cnty) {
client.auth
.loginWithCredential(new stitch.AnonymousCredential())
.then(() => fetchData(cnty))
.catch(err => {
console.error(err);
});
}
function fetchData(cnty) {
db
.collection("wildcat_area")
.find({ County: cnty }, { limit: 5000 })
.asArray()
.then(docs => {
//console.log(docs);
platTownship(docs);
})
.catch(err => {
console.error(err);
});
}
//Event Handlers, etc.
document.getElementById("downloadLink").addEventListener("click", function(){
saveSVG(document.getElementById("map"), "patent_map.svg");
});