A more efficient map overlay method for Terralib Vinícius Lopes Rodrigues Marcus Vinícius Alvim Andrade Gilberto Ribeiro de Queiroz Mirella Antunes de Magalhães Universidade Federal de Viçosa Departamento de Informática
Jan 06, 2016
A more efficient map overlay method for
Terralib
Vinícius Lopes RodriguesMarcus Vinícius Alvim Andrade
Gilberto Ribeiro de QueirozMirella Antunes de Magalhães
Universidade Federal de Viçosa
Departamento de Informática
Introduction
TerraLib: A Component Library for GIS Development
Developed by: INPE, Tecgraf/PUC-Rio, FUNCATE Implementation of “Small GIS”
TerralibTerralib has a geometric algorithms module
Used for manipulation of spatial dataContains all basic operations involving simple geometric forms (Points, Lines, Polygons)Spatial data are manipulated in a lower level
Terralib
Terralib has also a functional module
This module uses basic geometric operations to build functions in a higher level
Map Overlay
Description:Is used to combine the information of two mapsCalculates the geometrical overlay between map polygons and joins the non-spatial information of two maps
Map OverlayExample:
Terralib’s Polygon Overlay
Basic operation for map overlayComputes intersection, union or difference of two polygonsNamed TeOverlay – included in kernel of TerralibBased on Margalit and Knott’s algorithm
Terralib’s Polygon Overlay
The computation of the intersection points on the boundaries is essential to obtain the final resultThese points are used to determine the fragmentation of the boundaryThe generated fragments are grouped according to chosen operation
Terralib’s Polygon Overlay
Terralib’s Map Overlay
Let M1 and M2 be two maps
Suppose that M1 has less polygons than M2
a1a2
a3
b1
b2M1: blueM2: red
Terralib’s Map Overlay
In Terralib, the original method proceeds as the following:
for each polygon bi in M1, a spatial query on the database is done, fetching all the polygons on the map M2 which bounding box intercepts the bi’s bounding box
a1a2
a3
b1
b2
Terralib’s Map Overlay
The operation TeOverlay is applied to determine the intersection between the polygon ai and all polygons returned by the query.
To execute the operation above, it is necessary to determine the intersection points between the borders of the polygons.
a1a2
a3
b1
b2
Terralib’s Map Overlay
All the regions returned by the TeOverlay operation are stored in the resulting map
Each computed polygon has attributes from both the original polygons (maps)
Terralib’s Map Overlay
ConsiderationsThis operation proceeds many spatial queries on the database that implies a large execution time
The same polygon of the map M2 could be processed twice or more times
An alternative map overlay
Developed to avoid the database queries
The intersection points are found based on the Bentley & Ottman’s plane sweep algorithm.
The maps are full loaded from the database to build two segments sets.
So, the intersection algorithm is used to determine the intersection points between the segments of these two sets.
An alternative map overlay
a1a2
a3
b1
b2
After finding the intersection points, a matrix is built to store them.
In this matrix, the position ( i , j ) contains the intersection points between polygon bi from M1 and aj from M2
An alternative map overlay
a1a2
a3
b1
b2a1 a2 a3
b2
b1
p1
p2p3 p4
p5
p6p7
p8
p1
p2
p3
p4
p5
p6
p7
p8
An alternative map overlay
In this version, TeOverlay was modified to receive as parameter the intersection points previously calculated
For each position of the matrix where the list is not empty, the new version of TeOverlay is called with the respective polygons and their intersection points
An alternative map overlay
Special case: if a polygon a1 is “inside” another polygon b1. In this case, the list of intersection points is empty but the polygons intersection is not.To circumvent this case, the algorithm checks if the polygons bounding box intersect each other.If they intersect, only a point-polygon localization is needed
Results Input Maps:
Number Map Number of Regions
Number of segments
M1 Cities MG 853 61237
M2 Cities MG (translated) 853 61237
M3 Temperature MG 20 4659
M4 Soil MG 3067 858696
M5 Cities Brasil 5560 571747
M6 Cities Brazil (translated) 5560 571747
Results
M1M3
M4 M5
Results
M1 x M2
M1 x M4
M1 x M3
M5 x M6
Time Results
Results
Number Time (ms)
Overlay Intersections Output polygons
Terralib’s Alternative
M1 x M2 15382 3885 184516 25037
M1 x M3 3678 1323 21591 18626
M1 x M4 39317 7437 433884 172007
M5 x M6 110232 25657 1554776 307913
Future Work
Implement a plane sweep based map overlay
Based on Kriegel’s algorithm
Does not require database queries and intersection points are determined as result regions are generated