def convetBBoxtoMapillary(geohash): """ Converts a geohash into a string representing the bounding box coordinates in this order: Args: geohash (string):Geohash whose bounding box we want to obtain e.g. u0qj9 Return: (string): bounding box coordinates string in format West,South,East,North """ gh_bbox = gh.bbox(geohash) return str(gh_bbox["w"])+","+str(gh_bbox["s"])+","+str(gh_bbox["e"])+","+str(gh_bbox["n"])
def geohash_to_polygons(ghashes): """ Converts a list of geohashes to a shapely polygon. """ polygons = [] for ghash in ghashes: # bbox returns a tuple of lat, lon pairs which essentially is (y, x) in cartesian plane. # Converting it into (x, y) before passing to shapely. bounds = [ele[::-1] for ele in gh.bbox(ghash, coordinates=True)] polygons.append(Polygon(bounds)) return polygons
def getMapillaryBbox(geohash): """ Converts a geohash into a string representing the bounding box coordinates in this order: Args: geohash (string):Geohash whose bounding box we want to obtain e.g. u0qj9 Return: (dict): a bounding box as a dictionary """ gh_bbox = gh.bbox(geohash) return { "west": gh_bbox["w"], "south": gh_bbox["s"], "east": gh_bbox["e"], "north": gh_bbox["n"] }