def convert_by_type(lng, lat, type): if type == 'g2b': return gcj02_to_bd09(lng, lat) elif type == 'b2g': return bd09_to_gcj02(lng, lat) elif type == 'w2g': return wgs84_to_gcj02(lng, lat) elif type == 'g2w': return gcj02_to_wgs84(lng, lat) elif type == 'b2w': return bd09_to_wgs84(lng, lat) elif type == 'w2b': return wgs84_to_bd09(lng, lat) else: print('Usage: type must be in one of g2b, b2g, w2g, g2w, b2w, w2b') sys.exit()
def tPoint(lng, lat, type): if type == 'g2b': tcoord = gcj02_to_bd09(lng, lat) elif type == 'b2g': tcoord = bd09_to_gcj02(lng, lat) elif type == 'w2g': tcoord = wgs84_to_gcj02(lng, lat) elif type == 'g2w': tcoord = gcj02_to_wgs84(lng, lat) elif type == 'b2w': tcoord = bd09_to_wgs84(lng, lat) elif type == 'w2b': tcoord = wgs84_to_bd09(lng, lat) else: tcoord = [lng, lat] return tcoord
def transform(lon,lat): gcj_lon, gcj_lat = wgs84_to_gcj02(lon,lat) return (gcj_lon,gcj_lat)#-121.449652+121.444577 -31.025940+31.024322
def transform(lon, lat): gcj_lon, gcj_lat = wgs84_to_gcj02(lon, lat) return (gcj_lon, gcj_lat)