Hi,
i had a strange problem today. I am using some mojolicious REST stuff
with DBD::SQLite to query geojson features from a spatialite.
I had issues with wrong/all features beeing returned. After enabling
the db_trace i found that for example BuildMbr does not return anything
when passed quoted strings.
sqlite> select AsText(BuildMbr(8.482888,52.205703,8.488242,52.202669,4326));
POLYGON((8.482888 52.202669, 8.488242 52.202669, 8.488242 52.205703, 8.482888 52.205703, 8.482888 52.202669))
sqlite> select AsText(BuildMbr('8.482888','52.205703','8.488242','52.202669',4326));
sqlite>
Now - when using prepared statements ALL placeholder variables
will be quoted by DBD::SQLite so i currently see no possible way
to use a prepared statement.
My prepared statement contains something like this:
where ST_Intersects(geom, BuildMbr(?,?,?,?,4326))
I execute like this:
$sql->execute(8.48,52.20,8.49,52.25);
And the trace shows:
select AsGeoJSON(geometry) geojson,
MbrMinX(Buffer(geometry, 0.0005)) xmin,
MbrMaxX(Buffer(geometry, 0.0005)) xmax,
MbrMinY(Buffer(geometry, 0.0005)) ymin,
MbrMaxY(Buffer(geometry, 0.0005)) ymax,
lineway_id,lineway_type,lineway_changeset,areaway_id,areaway_type,areaway_changeset
from wayareaconflict
where ST_Intersects(geometry, BuildMbr('8.482888','52.205703','8.488242','52.202669',4326))
limit 500
Which returns the first 500 rows from the table as BuildMbr is empty.
Does anyone have a solution to this? I studied the DBD::SQLite Documentation and
the DBI documentation.
Flo
--
Florian Lohoff
f...@zz.de
UTF-8 Test: The 🐈 ran after a 🐁, but the 🐁 ran away