tilezen / mapbox-vector-tile

Python package for encoding & decoding Mapbox Vector Tiles
MIT License
245 stars 47 forks source link

Readme Encoding Example Error #65

Closed murphy214 closed 8 years ago

murphy214 commented 8 years ago

Hey guys,

I was trying out your example in the ReadMe but I can't seem to get it to work. I tried fixing this myself I know my readme examples might not work often times. I had a look at your implementation, and I found an issue in the _load_geometry() function. (I'm guessing from probably a change on shapely's end)

The load_wkb() and load_wkt() functions don't throw an actual exception when they die, at least in my implementation of shapely, so this try/except code block currently doesn't work as its probably intended anymore. You could probably make an inferences off a stringified block of geometry (i.e. if it contains '/' ) and fix it pretty easily.

    def _load_geometry(self, geometry_spec):
        if isinstance(geometry_spec, BaseGeometry):
            return geometry_spec

        try:
            return load_wkb(geometry_spec)
        except:
            try:
                return load_wkt(geometry_spec)
            except:
                return None

But after I tweaked that I was getting the error message '[Decode error - output not utf-8]' which I'm pretty sure is in the Protocol Buffer module, which I really can't debug so well as I've never used one. I was just wondering if I could get a working example to tinker with if possible?

Thanks guys!!!