首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
COMP8101代做、代写Python程序语言
项目预算:
开发周期:
发布时间:
要求地区:
COMP8101 – Advanced Topics in Data Engineering
Assignment 2 – Spatial Data
Deadline: October 31, 2023, 5pm
The goal of this assignment is to develop techniques for indexing and searching spatial data.
Part 1 (50%, index development)
You are asked to write a program, which constructs an R-tree for a set of polygons using bulk-loading. You
are going to read the data from two files given to you. Your program should compute the MBRs of each polygon
and then bulk-load the MBRs to an R-tree. You are going to use the z-order curve for sorting the MBRs. You
can find information about z-order at the lecture notes and at the following links:
https://en.wikipedia.org/wiki/Space-filling_curve
https://en.wikipedia.org/wiki/Z-order_curve
You are given two input files: coords.txt and offsets.txt. The first file contains coordinates of points at the form
,
. The second file includes records of the form
,
,
, where id is a unique
identifier of a polygon object and startOffset (respectively, endOffset) is the line number in the file coords.txt
where the coordinates of the points that form the polygon begin (respectively, end). For example, the first line
in file offset.txt is “0,0,11” which means that object with id=0 is a polygon with 12 vertices; the coordinates of
the first vertex are in line 0 of file coords.txt (i.e., -82.010671,32.183124), the coordinates of the second vertex
are in line 1 of file coords.txt, …, the coordinates of the 12th vertex are in line 11 of file coords.txt.
By reading the two files (concurrently), access the coordinates of each polygon object and then compute the
MBR of each object. For each MBR, compute the coordinates of the geometric center (by taking the mean of
each dimension) and then compute the z-order value of the center. Use this value as the sorting key and “pack”
the MBRs to form the leaf nodes of the R-tree. Then, construct the upper levels of the tree recursively. Please
note that you do not have to sort the MBRs of R-tree nodes to form the upper levels, but you should just place
them to non-leaf nodes in the order they are generated. For the tree construction, assume that each R-tree node
has maximum capacity 20 and minimum number of entries 0.4*20 = 8 (the root of the R-tree is an exception
because it can have less than 8 entries). This means that if the last node at each level has less than 8 entries, you
need to adjust the number of entries in that node and the previous one at the same level, such that the last node
has exactly 8 entries and the previous sibling less than 20. The leaves of the R-tree have entries of the form [id,
MBR], where MBR is the MBR of the object (in the form [x-low, x-high, y-low, y-high]) with identifier id. The
non-leaf nodes contain entries of the form [id, MBR], where id is the identifier of the R-tree node pointed by
the entry and MBR is the MBR of all the entries in the pointed node (again, the MBR is in the form [x-low, xhigh, y-low, y-high]).
If you are using Python, you may use function interleave_latlng from the following module:
https://github.com/trevorprater/pymorton/blob/master/pymorton/pymorton.py
to convert a pair of (x,y) coordinates to a z-order code. In this function, note that lat=latitude=y-coordinate and
lng=longitude= x-coordinate, so you should call interleave_latlng(y,x) to get the z-order value for an (x,y) point
(note that the return value is a string). You can sort the produced strings.
2
Alternatively, you are free to write your own z-order value computation function, if you wish to do so.
Your program should take as command-line arguments the two files that are given to you. At the program output
you should print the number of vertices per level, for example:
500 nodes at level 0
25 nodes at level 1
2 nodes at level 2
1 node at level 3
Your program should write to output text file Rtree.txt all nodes of the tree in order of their id. The format of
each each line of Rtree.txt should be as follows:
[isnonleaf, node-id, [[id1, MBR1], [id2, MBR2], …, [idn, MBRn]]]
where isnonleaf=1 if the node is not a leaf (isnonleaf=0), node-id is the id of the node and then follow the
entries of the node. For each entry, id is either a node-id, if the entry points to a node (isnonleaf=1), or an
object-id if the entry points to an object (isnonleaf=0). The MBR is of form[x-low, x-high, y-low, y-high] and
it is either the MBR of a node (if isnonleaf=1) or the MBR of an object (if isnonleaf=0). For example, the first
line of Rtree.txt could be as follows:
[0, 0, [[5868, [-170.844179, -170.707084, -14.373776, -14.287277]], ..., [3060, [-157.850181, -
157.848054, 21.301518, 21.303834]]]]
The vertex at the last line of Rtree.txt should be the root (since it is the last finalized node).
Part 2 (20%, range queries)
Implement range query evaluation using the R-tree that you constructed. The input of the query should be an
R-tree and a rectangle W and the objective is to find the object MBRs that intersect W. The function that
implements range search should take as input the node-id of the R-tree root, the query rectangle W in the form
[x-low, x-high, y-low, y-high]. To verify the correctness of your function, you are given file Rqueries.txt,
which includes range queries W of the form:
where x-low is the lower bound of W and x-high is the upper bound of W on the x-dimension (the bounds for
the y-dimension are defined correspondingly). For each query, output the ids of the objects whose MBR overlaps
with the window W of the query (filter step).
Your program should take as command-line arguments the R-tree file that you have created in Part 1 and the
queries file Rqueries.txt. It should first construct the R-tree, by reading the contents of the Rtree.txt file and then
read and evaluate each query from the query file. For each query, it should print at the output the line of the
query (starting from line 0), the number of query results in parenthesis, and the ids of the results, i.e., the
identifiers of the objects whose MBR intersects the query range.
Example:
0 (7): 2527,2712,8371,5042,7080,7656,7944
...
3
Part 3 (30%, kNN queries)
Implement the best-first nearest neighbor search algorithm. The version that you should implement is the
incremental NN algorithm, which uses a priority queue (heap) to organize the accessed R-tree entries based on
their distance to the query point. The heap should include node MBRs and object MBRs. When an object MBR
is de-heaped, it is the next nearest neighbor object to q.
Write a function that takes as input the root of the R-tree and a query point q, and computes and outputs the k
nearest neighbor object-ids to q in the R-tree, based on the object MBRs.
Your program should take as command-line arguments the R-tree file you created in Part1, file NNqueries.txt
and number k (number of nearest neighbors). It should first construct the R-tree, by reading the contents of the
Rtree.txt file and then read and evaluate each query from the query file. For each query, it should print at the
output the line of the query (starting from line 0), the number of query results in parenthesis, and the ids of the
results, i.e., the identifiers of the k objects whose MBR is the nearest to the point (x,y) of the corresponding line
in the query file.
Example (for k=10):
0 (10): 9311,7001,803,5361,6764,3905,1642,3260,4669,5762
...
Deliverables: You should submit your 3 programs and a single PDF file which documents the programs and
includes any additional comments. You can use a programming language of your choice, but your program
should be OS-independent. Please submit a single ZIP file with all requested programs and documents to
Moodle on or before 5:00pm, October 31st, 2023. Make sure all contents are readable. Please do not submit any
data files, your input files should be the same as given (please don’t rename them or use any self-modified files).
Please feel free to post your questions on Moodle forum or contact the TA of the course if you encounter any
difficulty in this assignment. We would be happy to help.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
urba6006代写、java/c++编程语...
2024-12-26
代做program、代写python编程语...
2024-12-26
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!