import types from OSciMap4 import TileData_v4_pb2 from OSciMap4.GeomEncoder import GeomEncoder from OSciMap4.StaticVals import getValues from OSciMap4.StaticKeys import getKeys from OSciMap4.TagRewrite import fixTag from TileStache.Core import KnownUnknown import re import logging import struct statickeys = getKeys() staticvals = getValues() # custom keys/values start at attrib_offset attrib_offset = 256 # coordindates are scaled to this range within tile extents = 4096 # tiles are padded by this number of pixels for the current zoom level (OSciMap uses this to cover up seams between tiles) padding = 5 def encode(file, features, coord, layer_name=''): layer_name = layer_name or '' tile = VectorTile(extents) for feature in features: tile.addFeature(feature, coord, layer_name) tile.complete()
# extracted from mapzen tilestache fork from OSciMap4 import TileData_v4_pb2 from OSciMap4.GeomEncoder import GeomEncoder from OSciMap4.StaticVals import getValues from OSciMap4.StaticKeys import getKeys from OSciMap4.TagRewrite import fixTag import logging import struct statickeys = getKeys() staticvals = getValues() # custom keys/values start at attrib_offset attrib_offset = 256 # coordindates are scaled to this range within tile extents = 4096 # tiles are padded by this number of pixels for the current zoom level # (OSciMap uses this to cover up seams between tiles) padding = 5 def encode(file, features, coord, layer_name=''): layer_name = layer_name or '' tile = VectorTile(extents) for feature in features: tile.addFeature(feature, coord, layer_name)