I would like to store latitude / longitude information in a POSTGIS database. I will need to query that data with simple contains query (for display on a map, so the bounding will be simple box) and lookup by lat/long.

As I'm new to all this GIS, what would be the recommend storage/column format? Anything that needs to be considered for indexes?

  • Please ask only one question per question. Indexing is a huge topic all by itself. – Vince Jan 29 '16 at 21:37

The column format for PostGIS is called geometry and you'll probably need to read up on all the functions associated with managing spatial columns.

If you are getting the lat/longs from GPS or Google, the projection will be EPSG:4326.

edit: iant's comment brings up a good point about the geography type, and indeed if you are using EPSG:4326 it looks like it will autocast to that type:

The geography type only supports the simplest of simple features. Standard geometry type data will autocast to geography if it is of SRID 4326.

  • Geography might be a better choice here – Ian Turton Jan 29 '16 at 21:32
  • Good point! Added to my answer. – Mintx Jan 29 '16 at 21:47
  • 1
    Nitpick. The type is geometry. I nitpick because as I recall ESRI has a PostgreSQL type called ST_Geometry whic is a different type from PostGIS geometry type. – LR1234567 Jan 30 '16 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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