1

I don't know yet what database I'll use in the future - MySql, Postgresql, Sqlite3 or anything else. At the moment I'm using a database N.

What's more or less universal approach for storing latitude & longitude? Varchar? Or big integer? Or float?

Should I store them in 2 columns or one?

0

1 Answer 1

3

Neither. The right answer is to use the GIS Spatial Type for a point. All of those databases have their own implementation.

PostgreSQL's PostGIS is easily the most full featured GIS implementation,

CREATE TABLE foo(
  gid  int GENERATED BY DEFAULT AS IDENTITY,
  geog geography(POINT)
);

I would highly suggest going PostgreSQL, and checking out the book PostGIS in Action if you're new to this. See also,

1
  • As of 5.7.x mysql has the proper set of MBR* and ST_* functions. I had no time to test them in production but it look way more promising than earlier unusable stub.
    – Kondybas
    Commented Jun 24, 2018 at 15:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.