I try to store a polygon in GeoJSON format into my PostGIS table. Both are using the CRS EPSG:3857
. This is how the polygon is defined. Note that I put in some whitespace to make it more readable.
{
"type":"Polygon",
"coordinates":[
[-91.23046875,45.460130637921],
[-79.8046875,49.837982453085],
[-69.08203125,43.452918893555],
[-88.2421875,32.694865977875],
[-91.23046875,45.460130637921]
],
"crs":{"type":"name","properties":{"name":"EPSG:3857"}}
}
To store that in my database I use the following SQL query.
INSERT INTO tablename (name, polygon)
VALUES ('name', ST_GeomFromGeoJSON('GeoJSON string comes here...'))
But for some reason the above query throws an error.
ERROR: Geometry has Z dimension but column does not
What is wrong in my attempt?