I am trying to make a column in a table with data type geoJSON, I have been told that it is the same as the geometry data type, but when I insert a geojson in the field it give me an SQL error. I am using phpgeAdmin. I am confused.
1 Answer
If the field is geometry
, then you need to use ST_GeomFromGeoJSON
like this,
INSERT INTO table (col)
VALUES ( ST_GeomFromGeoJSON(JSON) )