0

以下のように kartograph py を使用して svg マップを生成しようとしています。

from kartograph import Kartograph
K = Kartograph()
config ={"layers": {"mylayer": {"src": "42MEE250GC_SIR.shp"}} }
K.generate(config, outfile='mymap.svg')

そして、私はこのエラーが発生しています:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\k
artograph.py", line 46, in generate
    _map = Map(opts, self.layerCache, format=format)
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 48, in __init__
    me.proj = me._init_projection()
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 88, in _init_projection
    map_center = self.__get_map_center()
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 140, in __get_map_center
    features = self._get_bounding_geometry()
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 257, in _get_bounding_geometry
    charset=layer.options['charset']
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\l
ayersource\shplayer.py", line 121, in get_features
    geom = shape2geometry(shp, ignore_holes=ignore_holes, min_area=min_area, bbo
x=bbox, proj=self.proj)
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\l
ayersource\shplayer.py", line 159, in shape2geometry
    raise KartographError('unknown shape type (%d)' % shp.shapeType)
kartograph.errors.KartographError: ←[0;31;40mKartograph-Error:←[0m unknown shape
 type (25)

kartograph のソース コードを見ると、次のようになります。

    if shp.shapeType in (5, 15):  # multi-polygon
        geom = shape2polygon(shp, ignore_holes=ignore_holes, min_area=min_area)
    elif shp.shapeType == 3:  # line
        geom = points2line(shp)
    else:
        raise KartographError('unknown shape type (%d) in shapefile %s' % (shp.shapeType, self.shpSrc))
    return geom

誰かがこれで私を助けることができますか?

以下でこれを試しましたが、別のエラーが発生しました。

if shp.shapeType == 25:
  return None

エラー:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\k
artograph.py", line 46, in generate
    _map = Map(opts, self.layerCache, format=format)
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 50, in __init__
    me.bounds_poly = me._init_bounds()
  File "c:\python27\lib\site-packages\kartograph.py-0.6.8-py2.7.egg\kartograph\m
ap.py", line 205, in _init_bounds
    raise KartographError('no features found for calculating the map bounds')
kartograph.errors.KartographError: ←[0;31;40mKartograph-Error:←[0m no features f
ound for calculating the map bounds
4

1 に答える 1