cur.execute("select distance(GeomFromText('%f',geometry)) , astext(geometry) from dallas_texas_osm_line where name='South Cooper Street'", [matchPoint])
The actual query which is successfully run in spatialite-gui.exe is:
CREATE VIEW DisPOINTtoGEOM as
select distance(GeomFromText('POINT(-98.476332 33.675324)'),geometry) as DistancePOINTtoLINE, astext(geometry)
from TarrantRoads
where Fullname='S Cooper St'
The problem I can't represent POINT(X Y) correctly in Python; I got such below error:
line 42, in <module> cur.execute("select distance(GeomFromText('?',geometry)) , astext(geometry) from dallas_texas_osm_line where name='South Cooper Street'", [matchPoint]) sqlite3.OperationalError: wrong number of arguments to function distance()
What is “matchPoint” in your code? Also, why are you using “%f”?
Perhaps you should use the MakePoint() function inside the SQL, and pass the X and Y in.
Brad
--
You received this message because you are subscribed to a topic in the Google Groups "SpatiaLite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spatialite-users/ruX59Iywj2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spatialite-users+unsubscribe@googlegroups.com.
To post to this group, send email to spatialite-users@googlegroups.com.
Visit this group at https://groups.google.com/group/spatialite-users.
For more options, visit https://groups.google.com/d/optout.
Thanks for your reply,matchPoint is a string has the this value: POINT(-98.476332 33.675324)I'm trying to inject it in the query using "%f".How can I use MakePoint().Thanks,
Mousa
On Oct 23, 2017 11:32 PM, <br...@frogmouth.net> wrote:
What is “matchPoint” in your code? Also, why are you using “%f”?
Perhaps you should use the MakePoint() function inside the SQL, and pass the X and Y in.
Brad
--
You received this message because you are subscribed to a topic in the Google Groups "SpatiaLite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/spatialite-users/ruX59Iywj2s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to spatialite-use...@googlegroups.com.
To post to this group, send email to spatiali...@googlegroups.com.