Problem Storing Latitude and Longitude values in MySQL database

前端 未结 7 872
逝去的感伤
逝去的感伤 2020-12-24 03:19

I want to store the values of latitude and longitude fetched from Google Maps GeoCoding API in a MySQL database. The values are in float format.

12.92

7条回答
  •  孤独总比滥情好
    2020-12-24 03:55

    MySQL has special types for GIS applications.

    Use the point type and see:

    http://dev.mysql.com/doc/refman/5.0/en/spatial-extensions.html

    For a general discussion see: http://dev.mysql.com/tech-resources/articles/4.1/gis-with-mysql.html

    Some guys made a special UDF for computing distances between points on a sphere (i.e. earth)
    See: http://www.lenzg.net/archives/220-New-UDF-for-MySQL-5.1-provides-GIS-functions-distance_sphere-and-distance_spheroid.html

    Here's a howto: http://howto-use-mysql-spatial-ext.blogspot.com/2007/11/using-circular-area-selection.html

提交回复
热议问题