forked from gisalgs/geom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_projection2.py
43 lines (37 loc) · 1.07 KB
/
test_projection2.py
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
"""
Test drive for the Mollweide projection.
Contact:
Ningchuan Xiao
The Ohio State University
Columbus, OH
"""
__author__ = "Ningchuan Xiao <[email protected]>"
from osgeo import ogr
import matplotlib.pyplot as plt
from transform1 import *
from transform2 import *
from worldmap import *
fname = '../data/ne_110m_coastline.shp'
pp, numgraticule, numline = prep_projection_data(fname)
points=[]
for p in pp:
p1 = transform2(p[1], p[2])
points.append([p[0], p1[0], p1[1]])
frame = plt.gca()
for i in range(numline):
if i<numgraticule:
col = 'lightgrey'
else:
col = '#5a5a5a'
ptsx = [p[1] for p in points if p[0]==i]
ptsy = [p[2] for p in points if p[0]==i]
l = plt.Line2D(ptsx, ptsy, color=col)
#pts1 = [(p[1], p[2]) for p in points if p[0]==i]
#l = plt.Polygon(pts1, closed=None, fill=None, edgecolor=col)
frame.add_line(l)
plt.axis('scaled')
frame.axes.get_xaxis().set_visible(False)
frame.axes.get_yaxis().set_visible(False)
frame.set_frame_on(False)
frame.set_frame_on(True)
plt.show()