我有一个地名的数据转储(csv)
https://www.ordnancesurvey.co.uk/business-and-government/help-and-support/products/os-open-names.html
我需要将其导入mysql,但是几何坐标使用BNG(OSGB36)。Mysql是否有将这些坐标转换为wgs84 lat/long的函数,或者是否有其他sql方法来实现这一点?
另一个选择可能是将其加载到postgis中-postgis是否有将BNG转换为lat/long的功能?或许我可以这样做,然后将转换后的数据导出并加载到mysql中?
在postgis中,我可以做以下事情(未测试)
select AddGeometryColumn('locations', 'the_geom', 27700, 'POINT', 2);
-- X and Y are the BNG co-ordinates
UPDATE locations SET the_geom = ST_GeomFromText('POINT(' || x || ' ' || y || ')', 27700 );
alter table locations add column lat real;
alter table locations add column long real;
update locations set long=st_x(st_transform(the_geom,4326)),
lat=st_y(st_transform(the_geom,4326));
update locations set long=ST_X(ST_Transform(the_geom,4326)),
lat=ST_Y(ST_Transform(the_geom,4326));
我错了
function ST_Transform does not exist
. 我在使用mysql 5.7
样本数据:
NAME1 LOCAL_TYPE GEOMETRY_X GEOMETRY_Y DISTRICT_BOROUGH REGION COUNTRY
Southport Town 333510 417225 Sefton North West England