1

This question already has an answer here:

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?

marked as duplicate by Evan Carroll, Philᵀᴹ, mustaccio, LowlyDBA, Michael Green Jun 24 '18 at 10:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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,

  • 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 Jun 24 '18 at 15:23

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