I have a field in my table called 'geometry' that was created thus:
CREATE TABLE "public"."sites" ( "id" int8 DEFAULT nextval('sites_id_seq' :: regclass) NOT NULL, #... A few MORE fields "geometry" "public"."geometry", CONSTRAINT "sites_pkey" PRIMARY KEY ("id") ) WITH (OIDS = FALSE); CREATE INDEX "index_sites_on_geometry" ON "public"."sites" USING gist (geometry);
I can create a point with the command:
UPDATE sites SET geometry = ST_SetSRID ( ST_MakePoint (44.28, - 96.68, 495), 4326 ), WHERE ID = 12;
I would like to create a bounding box, but being new to the syntax have not been able to get the correct syntax.
My best attempt:
UPDATE sites SET geometry = ST_SetSRID ( ST_3DMakeBox ( ST_MakePoint (44.2, - 96.6, 400), ST_MakePoint (44.3, - 97.0, 400) ), 4326 ) WHERE ID = 1123;
Gives the error:
Column has Z dimension but geometry does not
I get this error even after trying
- wrapping the
ST_SetSRID(...)in a select statement as some online examples show (though the select statement returns a 2D result)
ST_Envelope(ST_Makelineas suggested by @mattmakesmaps
My apologies that I am new to this. I have been looking through the documentation and googling
postgis insert bouding box etc, but at my level, this isn't clear.