[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

spatialite 4



Hi all,

I'm using debian Sid, so I moved from spatialite 3 to spatialite 4 in
the last week.

Unfortunately, one of my python script failed : "IntegrityError:
TEXTURE.Geom violates Geometry constraint [geom-type or SRID not
allowed]"

As I'm very bad at searching on the web, it took me nearly one hour to
find that GeomFromText() function now default srid to 0 if it's not
specified.

It's quite tricky to find this information, as it's not specified in
the documentation
(http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.1.0.html), but in
the switching to 4.0 page
(https://www.gaia-gis.it/fossil/libspatialite/wiki?name=switching-to-4.0)
: "Please note: any Spatial SQL function creating a new Geometry (e.g.
ST_GeomFromText() and friends) will now assume SRID = 0 if no SRID
value was explicitly specified."

So I just had to change from :

insert into TEXTURE (NOM, TRI, geom) VALUES ('magnatum', 3,
GeomFromText('POLYGON((246.7532467532 204.5454545455, 480.5194805195
204.5454545455, 246.7532467532 439.3939393939, 246.7532467532
204.5454545455))'))

To :

insert into TEXTURE (NOM, TRI, geom) VALUES ('magnatum', 3,
GeomFromText('POLYGON((246.7532467532 204.5454545455, 480.5194805195
204.5454545455, 246.7532467532 439.3939393939, 246.7532467532
204.5454545455)), -1'))

As I'm using -1 srid.

I searched my Debian install, but I didn't find this information.

I'm not a professional developper, I'm an agronomist ! So I might be
wrong in the first place for not specifying the srid in my queries.

Anyway, if I'm writing to this list, firstly it's to thank you for all
the work you've done, and secondly to give you some feedback on my
little problem.

I was wondering if there would be a way to include some documentation
or warning for spatialite 3 to 4 transition, for Debian users. And
maybe suggest upstream documentation to include also this warning in
the functions.

Regards,

Sébastien


Reply to: