kartograph unknown shape type(25)
Question: I am trying to generate a svg map using kartograph py as below:

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

And I'm getting this error:

    
    
    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)
    

Looking at the source codes of kartograph we have this:

    
    
        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
    

Someone can help me with this?

I tried this below and I'm getting another error.

    
    
    if shp.shapeType == 25:
      return None
    

Error:

    
    
    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
    


Answer: The solution I found was to change the source code adding this:

    
    
    if shp.shapeType == 25:
      geom = points2line(shp)
    

I'm sure this is not the best solution but it solves my problem

