How can I calculate locationGeo space in pgadmin 3 type with PostGIS functions?

61 views Asked by At

My table name is map and I have latitude(double),longitude(double) and locationGeo(geometry) columns. I want to use a function to automatically compute the LocationGeo value using the given latitude and longitude values when I save a record. That's my wanted format:

Point(latitude,longitude),SRID

I can't find documentation for it in web.

enter image description here

1

There are 1 answers

0
JGH On

Using the default value is not the adequate way. What if you insert a record with no latitude or longitude? Instead you should either construct the geometry when you insert it, or make use of a trigger to make validation and compute it for you.