On Sat, 12 May 2018 06:27:23 -0700 (PDT), kk mensah wrote:
> SQL error: motorway_buffers.geometry violated geometry constraint
> [geom-type or SRID not allowed]
>
Hi,
rule number zero: always carefully check your data so to
discover what is causing troubles.
you've created the destination geometry column as:
SELECT AddGeometryColumn('motorway_buffers', 'geometry',
27700, 'MULTIPOLYGON', 'XY');
and consequently the possible causes for a constraint
violation are the followings:
1. any GeometryType different from MULTIPOLYGON
2. any SRID different from 27700
3. any Dimension different from XY
now, your first check should be to carefully verify
which values is actually returning your SQL query;
and in order do to this you just have to execute a
rather trivial diagnostic query such as:
SELECT GeometryType(g.g) AS type, Srid(g.g) AS srid,
CoordDimension(g.g) AS dims, Count(*) AS count
FROM
(
SELECT CastToMultiPolygon(ST_Buffer(geometry, 1000.0)) AS g
FROM motorway
) AS g
GROUP BY type, srid, dims;
after performing this very basic check you'll be probably
able to resolve the problem by yourself.
if not, you can eventually post a new message by specifying
your actual findings and asking for further help.
bye Sandro