# Geo-DMP: A DTN-Based Mobile Prototype for Geospatial Data Retrieval
## 3 Geo-DMP Mobile System
### The Development of the Map Adaptor Module  
Next, we will present the production process of another key component of the framework, the map adaptor. In a nutshell, we partition the vector map into three nested layers with proper region size as well as in compliance with typical typology in sociology studies [97]: blocks, communities, and subdistricts. We then transform them into a compact and portable database for mobile devices. Haidian District, which is one of the most developed and active places in central Beijing, is selected as our study area. Our proposal is entirely implemented with public vector data and non-commercial software. The raw vector data we use are the excerpt dataset of Beijing from OSM [98]. _1. Road Network_  
To begin with, we extract the road skeleton as the basis of the segmentation since it can represent the most meaningful borders of the city. We imported the raw data into a PostgreSQL [99] database with the support of PostGIS [100] (a geospatial extension to PostgreSQL) and picked six main road categories by their labels to compose the rough road network. They are _motorway_, _trunk_, _primary_, _secondary_, _tertiary_, and _residential_, respectively. Other road types are excluded as they are excessively detailed. The result is as shown in Figure 8.  
_2. Polygonization_  
Polygonization is the process whereby we can derive region polygons from road lines. The main idea of the method we take [101] is that, since the input line objects are elementary units for computing polygon objects, short and small lines will favor the construction of more and precise polygons. Therefore, road lines are broken into the smallest fragments (each fragment contains only two points) as the raw materials for the _polygonize_ function provided by Shapely [102], a python package for computational geometry. As we can observe from Figure 9, after the polygonization, all the objects become enclosed polygons, and lines that cannot form polygons are removed. Figure 8: The rough road network extracted from OSM vector dataset (partial). 3 Blocks  
As can be seen from the output of the preceding step, as the by-products of polygonization, a number of undesired tiny cells are generated, and some of them are even too small to be discernible. To resolve this problem, we calculate the area of all polygon objects and filter the tiny ones out (less than 0.01 km\({}^{2}\) as the general criterion). Then we merge them with the larger polygon that encompasses or adjoins them. The basic rules of merging operations are: (1) Regularity: In the premise of not damaging the main road lines, if one tiny polygon touches with multiple bigger ones, we will choose the way which makes the shape of merged polygon as regular and simple as possible. (2) Symmetry: To deal with tiny polygons that are generated around parallel roads or intersections, we will refer to the central line of the road or the central axis of interaction and merge them with the bigger polygons on the same side. (3) Consistency: If a merging operation is done, it will become the reference for the rest along the same road or direction, to make the overall merged boundaries continuous and smooth. These operations are done in QGIS [103], a free and open-source, yet powerful GIS suite. Upon the completion of merging, block regions are derived (Figure 10), which are regions of the finest granularity. Figure 10: Segmentation result of block regions. Figure 9: The effect after the polygonization (partial). 4. Subdistricts and Communities  
Because we expect that our map segmentation method can reflect administrative features, employing existing administrative boundaries will be the ideal choice. However, the districts, whose boundaries are off-the-shelf from the OSM vector data, are oversized for capturing the mobility of users. So administrative subdivisions on a smaller scale are desired. However, unlike some other countries, in accordance with laws and regulations of China, boundaries smaller than districts are not released officially.