Chandler, 1) As Muhammad mentioned, you want to check to make sure your geometries are in the same planar projection. First verify you brought them in with a specific projection By doing a SELECT ST_SRID(geom), ST_AsText(geom) As wkt FROM factory limit 1; SELECT ST_SRID(geom) FROM inner_area limit 1; 2) Your polygon may also be invalid in which case ST_Within will always return false, do a SELECT ST_IsValid(geom) FROM inner_area As i WHERE i.name = 'Dewsbury' 3) The casing of the name may be different in which case query 2 will return no records. e.g i.name = 'DEWSBURY' is not the same as i.name = 'Dewsbury' though it often is if you are used to working with SQL Server and other databases. Hope that helps, Regina http://www.postgis.us
_____ From: postgis-users-boun...@postgis.refractions.net [mailto:postgis-users-boun...@postgis.refractions.net] On Behalf Of Muhammad Imran Sent: Thursday, August 02, 2012 5:46 PM To: PostGIS Users Discussion Subject: Re: [postgis-users] area and distance Hi Chandler, Did you check projection system of the both Geometries? Just to make sure, use ST_TRANSFORM as inner function. regards Muhammad Imran --- On Fri, 8/3/12, CHANDLER DOUGLAS COLEMAN <chandler.d.cole...@stu.mmu.ac.uk> wrote: From: CHANDLER DOUGLAS COLEMAN <chandler.d.cole...@stu.mmu.ac.uk> Subject: [postgis-users] area and distance To: "postgis-users@postgis.refractions.net" <postgis-users@postgis.refractions.net> Date: Friday, August 3, 2012, 3:01 AM Hello, I am a newbie to PostGIS. I am hoping some one can explain to me why the following simple query doesn't return any info: SELECT f.fact_name FROM factory AS f, inner_area AS i WHERE i.name = 'Dewsbury' AND ST_WITHIN (f.geom,i.geom); I have geom in as a column and I have 'Dewsbury' as a polygon record in inner_area and there are 5 records in factory that fall within this polygon. But the resulting table shows that none were selected. My assumption here is that the SQL statement is correct, but that something is wrong with the tables: could it be how I imported the two tables from shapefiles. Thanks, Chandler -----Inline Attachment Follows----- _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users