简体   繁体   中英

How to store (latitude, longitude, altitude) tuple in MySQL database?

办法来存储纬度和经度PointMySQL数据库,但我怎么能存储(元组latitudelongitudealtitude在) MySQL数据库?

Use a POINT for the latitude and longitude, and a DECIMAL for the altitude:

CREATE TABLE Mountain (
  Location POINT NOT NULL,  -- Latitude/longitude
  Altitude DECIMAL(12, 2)   -- Altitude or height in meters or feet or furlongs if you prefer
) ENGINE=InnoDB;

or, just use three decimals - one for latitude, one for longitude, one for altitude:

CREATE TABLE Mountain (
  Latitude   DECIMAL(10, 7),
  Longitude  DECIMAL(10, 7),
  Altitude   DECIMAL(11, 1)
) ENGINE=InnoDB;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM