0

I'm trying to store pure Geometry values in DB2 on a flat plane, no spatial reference or projection, apologies on the nomenclature as I might be a little off, basically planar cartesian coordinates. So from what I can see I need to specify SRID 0. However, it seems I can't store negative values with SRID 0. I have a table with 2 columns "GeometryName" VARCHAR(30) and "GeometryData" DB2GSE.ST_GEOMETRY. When I try to insert values like so:

INSERT INTO "geometry_tests"."spatial_reference" ("GeometryName", "GeometryData") 
VALUES ('PY0', db2gse.ST_GeomFromText('POLYGON ((-1 1, -2 1, -2 2, -1 2, -1 1))', 0))

I get the following error:

SQL Error [38SSG]: Routine "DB2GSE.GSEGEOMFROMWKT" (specific name "GSEGEOMWKT1") has returned an error SQLSTATE with diagnostic text "GSE3416N  Coordinate out of bounds.".. SQLCODE=-443, SQLSTATE=38SSG, DRIVER=4.31.10

I tracked this down to negative coordinates. Other SRID's will accept negative values. How am I supposed to store negative coordinates where I don't want a spatial reference system? Just a regular Cartesian plane, with negative coordinates.

3
  • You can't store negative coordinates in SRID 0. Period. If you want negative coordinates, you need a spatial reference system. Actually, you always want a spatial reference system, because doing without one will only cause trouble. The Understanding Coordinate Management whitepaper explains why you can't store negative values in DB2's ST_GEOMETRY without a spatial reference using a negative false origin.
    – Vince
    Commented Sep 5, 2023 at 2:58
  • This DB2 documentation seems to explain the same, the values are stored into DB2 as positive integers. But this ibm.com/docs/en/db2/11.5?topic=functions-st-srid-st-srsid suggests that SRID 1 might work for you. Or maybe it is limited to -180 / -90 degrees.
    – user30184
    Commented Sep 5, 2023 at 9:38
  • You can store negative coordinates in a number of other databases with SRID 0, Oracle, MySql, SQL Server and Postgres. If there is an SRID that allows me to store geometries like I've mentioned above then that will work. I'm not storing map coordinates. This is purely for geometric math. Commented Sep 5, 2023 at 15:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.