Use QGIS to customize the railway line symbol of the Gaode map style

Symbol is the language of the map, it is the simplification, generalization and abstraction of the spatial shape of geographic elements. As a general and international GIS software, QGIS comes with a diversified library of predefined symbols. The related open source community has also contributed many symbols made by map experts, but it is still difficult to meet the personalized map symbol needs of all users. It is the difference between the domestic map symbol standard and the international one, and the domestic participation in the open source community is not very active. As a result, the common domestic map symbols are not added to the QGIS default symbol library and cannot be obtained from other channels. You need to do it yourself Make custom symbols. For example, the railway line type in the Gaode map is not provided in the QGIS default symbol library:

 

 

This article takes the city map of OpenStreetMap as an example to share the process of QGIS extracting OpenStreetMap railroad data and customizing railroad line symbols on AutoNavi Map.

 

Demonstration data download address:

Link:  https://pan.baidu.com/s/1z5b5fR42yZQvwYs8-tyWjw 

Extraction code:  v5q1 

 

 01 Data preprocessing

 

Open QGIS, click the [Add Vector Layer] button in the layer management toolbar , find the downloaded data, and add three layers of points, lines, and polygons to the map window:

 

 

Points, lines, and polygons correspond to the three element sets of points, lines, and regions downloaded from OpenStreetMap. Set points and polygons to not display in the layer panel. These two layers are used as background data and will not be displayed to the map window for the time being. .

 

Right-click the lines layer -> [Open Attribute Table], you can see that the layer uses the "railway" field to indicate whether the feature is a railway, and the attribute values ​​are as follows:

 

Empty: indicates that the line feature is not a railway;

construction: Railway under construction;

rail: build a railway;

subway: The subway is built.

 

 

According to the above analysis of attribute data, use [rule-based] rendering on the lines layer , and construct expressions to extract railway elements:

 

Select the lines layer, click the  button to open the layer style panel, click the drop-down box to select [Based on Rules], click the  button below to add rules for the layer:

 

 

By default, the newly created rule does not filter any elements. Double-click the rule to enter the [Edit Rule] interface, fill in "Railway" in the [Label] text box, click the  button, and enter the following expression to filter out the railway elements:

"railway"  =  'rail'

 

 

So far the data preprocessing work is completed, and the railway line elements are as follows:

 

 02 Make railway line symbols

 

Next we start to make custom railway symbols.

 

In the panel below] [editing rules embedded symbol selector assembly (Symbol selector widget), may select the symbol in symbol library of predefined by the interface for the rule, or according to need to customize the new line symbol:

 

 

In QGIS, the effect of the railway symbol in the Gaode map requires a combination of two symbol layers : the dark gray symbol layer is used as the background color, and the white line segment is superimposed on it. Therefore, first click the  button to add a symbol layer:

 

 

Set the two symbol layers to be of the "simple line" type, and select the second "simple line" symbol layer to set the railway background color. The properties are as follows:

 

Color: Use the color picking tool to pick up the RGB value (191, 196, 205) from the gray background of the railway line on the Gaode map, and copy the color to QGIS;

Stroke width: 1mm;

End style: flat.

 

 

Select the first "simple line" symbol layer to set the white line segment, the properties are as follows:

 

Color: white;

Stroke width: 0.6mm (slightly smaller than the width of the background color, leaving a dark gray border);

End style: flat;

Use custom horizontal stroke pattern: check "Use custom horizontal stroke pattern", and click the dash button below, in the pop-up "custom horizontal stroke pattern" panel, set the dash to 1.5mm and the space to 3mm . This step is the key to the effect of the railway line symbol.

 

 

At this point, you can see that the changes of railway line symbols have been reflected in the map window in real time. In order to be reused, you can save the set symbols in the system symbol library:

 

Select "Line" -> [Save Symbol...] ​​in the symbol layer, enter the name and label of the symbol in the pop-up dialog box, and click [save].

 

 

When you need to use this linear symbol again, you only need to find and select the symbol in the predefined symbol library to apply it to the layer symbolization expression.

 

 

Extract other basic elements of the lines and polygons layer, such as water system, green space, etc., as the background, and the final railway line symbol effect is as follows:

 

 

 


Copyright Notice

 

This article welcomes reprinting, please indicate the source when reprinting.

 

Guess you like

Origin blog.csdn.net/QGISClass/article/details/113666985