On running sqlite CREATE and INSERT queries, I was getting some mysterious errors, like “Error: disk I/O error”, despite having the proper permissions on the .sqlite file and adequate space in the directory. I then broke down the compound query to a simple query and was getting “GEOS error: IllegalArgumentException: Points of LinearRing do not form a closed linestring”, though I found that doing Hex(PolygonFromText(…)) did return a hex string. My WKT was, however, poorly formed. WKT requires that the final coordinate pair and the beginning coordinate pair are the same, as in PolyFromText(‘POLYGON((-75.8 38.4, -75.0 38.4, -75.0 39.85, -75.8 39.85))’,4236). After I fixed that, my more complex queries were able to run successfully.