On Wed, 8 Sep 2021 10:41:29 -0700 (PDT), Guen LM wrote:
> Do you know where is the problem please ?
>
how to correctly (and quickly) resolve this kind of
problems.
the golden rule: always test your SQL code step by step
carefully avoiding too much complex statements.
so we'll start by testing GeomFromGeoJSON() alone
SELECT GeomFromGeoJSON('{"type":"MultiPolygon",
"coordinates":[[[[4.96155079044088,45.77560724373348],
[4.962346534809607,45.77570845150045],[4.962250134932329,
45.77537893550701],[4.961608743451676,45.77527504348121],
[4.96155079044088,45.77560724373348]]]]}');
ok, it returns a Geometry; but calling the BLOB exporer
widget supported by the GUI we'll soon discover that
it actually is a MULTIPOLYGON, but the SRID has the
default value (0).
this doesn matches the geometry constraints, and the
INSERT will obviously fail.
the solution now becomes evident; we need to set
SRID=4326
correctly rewriting the SQL statement:
INSERT INTO geoilot (ilot_id,GEOMETRY)
VALUES (12345,
SetSrid(GeomFromGeoJSON('{"type":"MultiPolygon",
"coordinates":[[[[4.96155079044088,45.77560724373348],
[4.962346534809607,45.77570845150045],[4.962250134932329,
45.77537893550701],[4.961608743451676,45.77527504348121],
[4.96155079044088,45.77560724373348]]]]}'), 4326)
note: exactly as previously suggested by Peter.
bye Sandro