search

Home  >  Q&A  >  body text

lbs - Mysql POINT类型数据,怎么计算经纬度偏差

使用新的point类型存储经纬度,现在要将GPS坐标转换成bd坐标,需计算其两值偏差,如果单独拿出经度、纬度计算的话不能完整的利用数据库的索引,如果直接使用point类型计算其经纬度差值,需要用什么方法?

高洛峰高洛峰2785 days ago668

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-17 16:19:04

    Thank you for paying attention to the answer;
    After studying the official MySql document (starting from 5.7 Chapter 13, Section 15, page 1752), there are many functions related to geographical location and space available, such as the ST_Distance function reminded on the first floor, and ST_Intersects() to calculate two Points have the same attributes. ST_Difference() calculates different attributes of two points. Does ST_Buffer() calculate the deviation?
    After trying a lot, it still doesn’t work. Then I studied the official PostGis documentation (version 2.3, starting from Chapter 14, page 685). It seems that there are more support functions. I saw ST_Summary and wanted to directly add the deviation value and convert the GPS coordinates to bd, but, This

    mysql> SELECT ST_Summary(point(3,4),POINT(4,5));
    ERROR 1305 (42000): FUNCTION ST_Summary does not exist
    
    ERROR:  function st_summary(point, point) does not exist
    LINE 1: SELECT ST_Summary(point(3,4),POINT(4,5));
                   ^
    HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
    

    It makes me very sad

    Come back to the OpenGIS documentation. This one does not introduce general functions. It basically introduces how to use it. I then went back to study the built-in functions of PostGIS, which were imported directly using the sql file during installation. In the end, I concluded that I would write a function by myself. Maybe It’s faster, there’s no need to use this!

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 16:19:04

    Thanks for the invitation, I am not very familiar with itpoint. I did a rough search of the information. I hope it will be helpful to you. Portal

    reply
    0
  • Cancelreply