|
@@ -414,18 +414,18 @@ def get_loc():
|
|
|
|
|
|
def convert_geo():
|
|
|
with session_maker() as session:
|
|
|
- hotels = session.query(SaaSHotel).filter((SaaSHotel.loc_type == 1 or SaaSHotel.loc_type == 3) and SaaSHotel.lon.is_not(None) and SaaSHotel.lat.is_not(None)).all()
|
|
|
+ hotels = session.query(Hotel).filter((Hotel.s_loc_type == 1 or Hotel.s_loc_type == 3) and Hotel.s_lon.is_not(None) and Hotel.s_lat.is_not(None)).all()
|
|
|
i = 0
|
|
|
length = len(hotels)
|
|
|
for h in hotels:
|
|
|
i += 1
|
|
|
try:
|
|
|
- if h.loc_type == 3:
|
|
|
- h.lon, h.lat = gcj02_to_wgs84(h.lon, h.lat)
|
|
|
- h.loc_type = 2
|
|
|
- elif h.loc_type == 1:
|
|
|
- h.lon, h.lat = bd09_to_wgs84(h.lon, h.lat)
|
|
|
- h.loc_type = 2
|
|
|
+ if h.s_loc_type == 3:
|
|
|
+ h.s_lon, h.s_lat = gcj02_to_wgs84(h.s_lon, h.s_lat)
|
|
|
+ h.s_loc_type = 2
|
|
|
+ elif h.s_loc_type == 1:
|
|
|
+ h.s_lon, h.s_lat = bd09_to_wgs84(h.s_lon, h.s_lat)
|
|
|
+ h.s_loc_type = 2
|
|
|
|
|
|
if i % commit_buff_size == 0 or i >= length:
|
|
|
session.commit()
|