I see that the Point type is made to store geometric coordinates, however I don't see what problem it is trying to solve, or what advantages it offers over simply using two numerical columns. It's 16 bytes, so is it just an abstraction for two 8 byte floats? Or is it a string containing some kind of geohash that optimizes the performance of certain queries?
Let's say I want to get all the points for a specific viewport on a Leaflet map… with numerical columns representing latitude and longitude, I'd just filter for all the rows that have a latitude number between the N/S bounds and a longitude number between the E/W bounds, easy. I looked into using Point here, but the syntax is cumbersome and it seems to me like unnecessary overhead for development and for database performance… is it?
Best Answer
A few advantages,
(SRID,long,lat)
you'd have a very complex time defining sensible sorts and a custom r-tree index over the composite type.It also provides standardized coercions to and from text use Well-known Text, and to and from binary using Well-known Binary.
As it applies to your leaflet example,
First, you can't. One degree of longitude converges to 0 as you move towards the pole. Second, even if you could, it would be convoluted. Instead consider the GIS method,
Distance in meters! How nice is that. ;)