Intersection not working ==> SQL is the cause?

14 views
Skip to first unread message

John L. Poole

unread,
Mar 29, 2010, 11:20:21 PM3/29/10
to GeoCommons Geocoder
After modifying the code as referenced in the many prior postings I've
made to this forum, I'm getting successful results for a basic entry
such as "2133 First St., Napa, CA". However, when I try to do an
intersection, "Trancas and Jefferson, Napa, CA", the program bombs out
because it is trying to treat coordinates as not packed when perhaps
they are?

I noticed in the code, when an intersection presents itself, the
following SQL is defined:

sql = "
CREATE TEMPORARY TABLE intersection AS
SELECT fid, substr(geometry,1,8) AS point
FROM feature_edge, edge
WHERE feature_edge.tlid = edge.tlid
AND fid IN (#{in_list})
UNION
SELECT fid, substr(geometry,length(geometry)-7,8) AS point
FROM feature_edge, edge
WHERE feature_edge.tlid = edge.tlid
AND fid IN (#{in_list});
CREATE INDEX intersect_pt_idx ON intersection (point);"

It appears that the SQL is hard-wired to expect a certain number type.

Does anyone have an opinion about whether "substr(geometry,1,8)" and
"substr(geometry,length(geometry)-7,8)" need to be modified? I'm
thinking if there was a problem between geometry that is packed vs.
unpacked, the same dichotomy presents problems in the above SQL.

Reply all
Reply to author
Forward
0 new messages