tilezen / mapbox-vector-tile

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

ERROR ParseException: Unknown WKB type 79 #104

Closed guyanf closed 6 years ago

guyanf commented 6 years ago

Hi All: When I use encode, there are some errors in the logfile. eg: ERROR ParseException: Unknown WKB type 79(Maybe 73/69/85/other)

This is code:

`import mapbox_vector_tile import logging logging.basicConfig(level=logging.INFO, format="""%(asctime)s %(levelname)s %(message)s""", datefmt='%d %b %H:%M:%S', filename='nohup.out', filemode='a')

lstaa = [{'name': 'landuse', 'features': [{'geometry': 'POLYGON((12919736.356835 4887077.83976072,12920078.4627125 4887230.62499933,12921631.3913512 4888136.66558616,12922138.25198 4888498.87675088,12922138.25198 4887077.83976072,12919736.356835 4887077.83976072))', 'id': 131103, 'properties': {'name_chn': 'aa', 'name': 'aa', 'ad_code': '110100', 'sort_rank': '200', 'lua_type': 2020, 'disp_class': 1, 'gid': 131103, 'name_eng': None}}]}] aa = mapbox_vector_tile.encode(lstaa)

print 'start' print aa print ''20

bb = mapbox_vector_tile.decode(aa) print bb print 'game over' `

But no error in the terminal, why? Thanks!

zerebubuth commented 6 years ago

The errors are appearing in the log file because your code configures the root logger to send all messages to the nohup.out log file. The parse error is being logged by Shapely's GEOS module, using the name shapely.geos, but will be handled by the root logger unless it has been overridden with something more specific. We can reconfigure it to only print errors to the terminal like this:

import sys
...
log = logging.getLogger('shapely.geos')
ch = logging.StreamHandler(stream=sys.stderr)
ch.setLevel(logging.ERROR)
log.addHandler(ch)
log.propagate = False

Hope that helps!