我正在尝试从GEOFLA shapefile 生成 svg 地图。
使用“bbox”边界模式并手动设置 bbox 值效果很好:
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "bbox",
"data": [-4.5, 42, 8, 48],
},
"export": {
"width": 600,
"ratio": 0.8
}
}
但是当将边界模式设置为“多边形”时,我得到一个空的 svg 地图:
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "polygons",
"data": {
"layer": "depts"
},
"padding": 0.06
},
"export": {
"width": 600,
"ratio": 0.8
}
}
我查看了 kartograph 文件,我注意到“map.py”中的“get_features”方法返回一个 Polygon,其坐标与之前从 shapefile 中提取的几何特征不相交。
然后,在检查特征几何是否与“layer.map.view_poly”属性相交时,每个特征都会在“maplayer.py”文件的“get_features”方法中被丢弃。