# A more efficient map overlay method for Terralib

Jan 06, 2016

## Documents

leann

Universidade Federal de Viçosa. Departamento de Informática. 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. Introduction. TerraLib: A Component Library for GIS Development - PowerPoint PPT Presentation

#### final resultthese points

• A more efficient map overlay method for Terralib

Vincius Lopes RodriguesMarcus Vincius Alvim AndradeGilberto Ribeiro de QueirozMirella Antunes de Magalhes

• Introduction

TerraLib: A Component Library for GIS DevelopmentDeveloped by: INPE, Tecgraf/PUC-Rio, FUNCATE Implementation of Small GIS

• TerralibTerralib has a geometric algorithms moduleUsed for manipulation of spatial dataContains all basic operations involving simple geometric forms (Points, Lines, Polygons)Spatial data are manipulated in a lower level

• TerralibTerralib has also a functional moduleThis module uses basic geometric operations to build functions in a higher level

• Map OverlayDescription: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:

• Terralibs Polygon OverlayBasic operation for map overlayComputes intersection, union or difference of two polygonsNamed TeOverlay included in kernel of TerralibBased on Margalit and Knotts algorithm

• Terralibs Polygon Overlay

• Terralibs Polygon OverlayThe 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

• Terralibs Map OverlayLet M1 and M2 be two maps

Suppose that M1 has less polygons than M2

• a1a2a3b1b2M1: blueM2: red

• Terralibs Map OverlayIn 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 bis bounding box

• a1a2a3b1b2

• Terralibs Map OverlayThe 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.

• a1a2a3b1b2

• Terralibs 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)

• Terralibs 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 overlayDeveloped to avoid the database queries

The intersection points are found based on the Bentley & Ottmans plane sweep algorithm.

• An alternative map overlayThe 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.

• a1a2a3b1b2

• An alternative map overlayAfter 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

• a1a2a3b1b2a1a2a3b2b1p1p2p3p4p5p6p7p8p1p2p3p4p5p6p7p8

• An alternative map overlayIn 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 overlaySpecial 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:

NumberMapNumber of RegionsNumber of segmentsM1Cities MG85361237M2Cities MG (translated)85361237M3Temperature MG20 4659M4Soil MG3067858696M5Cities Brasil5560571747M6Cities Brazil (translated)5560571747

• ResultsM1M3M4M5

• ResultsM1 x M2M1 x M4M1 x M3M5 x M6

• Results Time Results

NumberTime (ms)OverlayIntersectionsOutput polygonsTerralibsAlternativeM1 x M215382388518451625037M1 x M3367813232159118626M1 x M4393177437433884172007M5 x M6110232256571554776307913

• Future WorkImplement a plane sweep based map overlay

Based on Kriegels algorithm

Does not require database queries and intersection points are determined as result regions are generated

• QuestionsVincius Lopes [email protected]???????????????????

Welcome message from author