我试图从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文件,我注意到" get_features" " map.py"中的方法返回一个多边形,其坐标与之前从shapefile中提取的要素几何相交。
然后,每个功能都会丢弃在" get_features" " maplayer.py"的方法检查要素几何是否与" layer.map.view_poly"相交时的文件属性。
答案 0 :(得分:2)
我在使用GEOFLA文件投影时遇到了类似的问题。 我发现的解决方案基本上是使用QGIS更改我的shapefile投影。我的想法是使用安装指南中给出的shapefile投影,这对我有用。
从kartograph安装页面获取example shape file
检查新形状文件是否具有正确的投影:
cat DEPARTEMENT_WGS84.prj
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
现在,您的脚本应该可以正常使用新的形状文件。