>>> from env_helper import info; info()
页面更新时间: 2024-04-09 09:02:46
运行环境:
Linux发行版本: Debian GNU/Linux 12 (bookworm)
操作系统内核: Linux-6.1.0-18-amd64-x86_64-with-glibc2.36
Python版本: 3.11.2
16.6. 制图¶
16.6.1. Mapnik中使用XML定义不同的线状要素端点形状¶
>>> !cat m1_line_cap.xml
<Map background-color="#efefef" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linecap="round"/>
<Filter>[id] = 1</Filter>
</Rule>
</Style>
<Style name="My Style2">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linecap="butt"/>
<Filter>[id] = 2</Filter>
</Rule>
</Style>
<Style name="My Style3">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linecap="square"/>
<Filter>[id] = 3</Filter>
</Rule>
</Style>
<Style name="My Style4">
<Rule>
<LineSymbolizer stroke="#000000" stroke-width="2" stroke-linejoin="miter"/>
</Rule>
</Style>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style2</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style3</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style4</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
</Map>
16.6.2. Mapnik中使用XML定义不同的线状要素连接样式¶
>>> !cat m2_line_join.xml
<Map background-color="#efefef" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linejoin="miter"/>
<Filter>[id] = 1</Filter>
</Rule>
</Style>
<Style name="My Style2">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linejoin="round"/>
<Filter>[id] = 2</Filter>
</Rule>
</Style>
<Style name="My Style3">
<Rule>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="20" stroke-linejoin="bevel"/>
<Filter>[id] = 3</Filter>
</Rule>
</Style>
<Style name="My Style4">
<Rule>
<LineSymbolizer stroke="#000000" stroke-width="2" stroke-linejoin="miter"/>
</Rule>
</Style>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style2</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style3</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style4</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_line3.shp</Parameter>
</Datasource>
</Layer>
</Map>
16.6.3. Mapnik中使用XML定义不同的线状要素连接样式¶
>>> !cat m3_poly_fill.xml
<Map background-color="#efefef" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<Style name="My Style">
<Rule>
<PolygonSymbolizer fill="#ffffff"/>
<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="1" stroke-dasharray="8,20"/>
<PolygonPatternSymbolizer width="6" height="6" type="png" file="/gdata/sym_line45.png"/>
</Rule>
</Style>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>My Style</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/gdata/fig_data/fig_data_poly.shp</Parameter>
</Datasource>
</Layer>
</Map>