-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathload_citybuf.py
41 lines (31 loc) · 989 Bytes
/
load_citybuf.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
# load_citybuf.py
from sys import argv
import resource
import CityBufReader
from CityBuf_.GeometryType import GeometryType
fpath = argv[1]
maxrss = 0.0
no_solid = 0
no_msurface = 0
with open(fpath, "rb") as file:
reader = CityBufReader.CityBufReader(file)
for feature in reader.features():
memory = resource.getrusage(resource.RUSAGE_SELF)
a = memory.ru_maxrss / 1024 / 1024
if a > maxrss:
maxrss = a
for i in range(feature.ObjectsLength()):
obj = feature.Objects(i)
for j in range(obj.GeometryLength()):
geom = obj.Geometry(j)
if geom.Type() == GeometryType.Solid:
no_solid += 1
elif geom.Type() == GeometryType.MultiSurface:
no_msurface += 1
memory = resource.getrusage(resource.RUSAGE_SELF)
a = memory.ru_maxrss / 1024 / 1024
if a > maxrss:
maxrss = a
print(maxrss)
# print(no_solid)
# print(no_msurface)