def get_transform(bounds, size=1024):
 (tx, ty) = (bounds[0], bounds[1])
 (sx, sy) = (((bounds[2] - bounds[0]) / size), ((bounds[3] - bounds[1]) / size))
 def forward(lon, lat):
  ' Transform a longitude and latitude to TopoJSON integer space.\n        '
  return (int(round(((lon - tx) / sx))), int(round(((lat - ty) / sy))))
 return (dict(translate=(tx, ty), scale=(sx, sy)), forward)

def get_transform ( bounds , size = 1024 ) : ( tx , ty ) = ( bounds [ 0 ] , bounds [ 1 ] ) ( sx , sy ) = ( ( ( bounds [ 2 ] - bounds [ 0 ] ) / size ) , ( ( bounds [ 3 ] - bounds [ 1 ] ) / size ) ) def forward ( lon , lat ) : return ( int ( round ( ( ( lon - tx ) / sx ) ) ) , int ( round ( ( ( lat - ty ) / sy ) ) ) ) return ( dict ( translate = ( tx , ty ) , scale = ( sx , sy ) ) , forward )
return a topojson transform dictionary and a point-transforming function .