[postgis-users] Intersection query problem

George Washington gws293 at hotmail.com
Tue May 10 20:15:14 PDT 2011


Hi, I have the following query:

SELECT  gid,  name, track_use, st_astext(clipped_geom)
FROM  (SELECT  source.track_cl.gid,  source.track_cl.name,  source.track_cl.track_use,(ST_Dump(ST_Intersection(extents.tiles.the_geom,  source.track_cl.the_geom))).geom  As  clipped_geom
FROM  source.track_cl
INNER  JOIN  extents.tiles
ON  ST_Intersects(extents.tiles.the_geom,  source.track_cl.the_geom) where extents.tiles.name='BP33' ) As  clipped 
WHERE  st_geometrytype(clipped.clipped_geom) = st_geometrytype(source.track_cl.the_geom);

 which gives me:

ERROR:  missing FROM-clause entry for table "track_cl"
LINE 6: ...metrytype(clipped.clipped_geom) = st_geometrytype(source.tra...
SQL state: 42P01
Character: 471


On the other hand this version of the same query works (only the last line differs):


SELECT  gid,  name, track_use, st_astext(clipped_geom)
FROM  (SELECT  source.track_cl.gid,  source.track_cl.name,  source.track_cl.track_use,(ST_Dump(ST_Intersection(extents.tiles.the_geom,  source.track_cl.the_geom))).geom  As  clipped_geom
FROM  source.track_cl
INNER  JOIN  extents.tiles
ON  ST_Intersects(extents.tiles.the_geom,  source.track_cl.the_geom) where tiles.name='BP33' ) As  clipped
WHERE  ST_Dimension(clipped.clipped_geom)  >0;

I cannot figure out what is wrong with the first query.
Many thanks.
George
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110511/a188ce62/attachment.html>


More information about the postgis-users mailing list