-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjlu.py
More file actions
49 lines (44 loc) · 1.23 KB
/
jlu.py
File metadata and controls
49 lines (44 loc) · 1.23 KB
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
# -*- coding: latin-1 -*-
import csv
print """<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>吉大北美校友分布图</title>
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script>
function initialize() {
var myLatlng = new google.maps.LatLng(37.4219957,-122.0843128);
var center = new google.maps.LatLng(38.5804149,-98.4107151);
var mapOptions = {
zoom: 4,
center: center
}
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
var markers = [];
"""
with open('jlu.csv') as f:
reader = csv.DictReader(f)
for row in reader:
print ' markers.push(new google.maps.Marker({'
print ' position: new google.maps.LatLng(',row['经纬度'],'),'
print ' map:map,'
print ' title:"',row['Marker显示信息'],'"'
print ' }));'
print '}'
print """google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
"""