<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 9.00.8112.16447"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>Chandler,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>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</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>By doing a </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>SELECT ST_SRID(geom), ST_AsText(geom) As
wkt</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>FROM factory limit 1;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>SELECT ST_SRID(geom)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>FROM inner_area limit 1;</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>2) Your polygon may also be invalid in which case
ST_Within will always return false, do a </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>SELECT ST_IsValid(geom)</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>FROM inner_area As i</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>WHERE i.name = 'Dewsbury'</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>3) The casing of the name may be different in which
case query 2 will return no records.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>e.g i.name = 'DEWSBURY' is not the same as i.name
= 'Dewsbury'</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>though it often is if you are used to working with SQL
Server and other databases.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>Hope that helps,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012>Regina</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012><A
href="http://www.postgis.us">http://www.postgis.us</A></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=844482710-04082012></SPAN></FONT> </DIV></SPAN></FONT></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Muhammad Imran<BR><B>Sent:</B> Thursday, August 02, 2012 5:46
PM<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users]
area and distance<BR></FONT><BR></DIV>
<DIV></DIV>
<TABLE border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD vAlign=top>Hi Chandler,<BR><BR>Did you check projection system of the
both Geometries? Just to make sure, use ST_TRANSFORM as inner
function.<BR><BR>regards <BR><BR>Muhammad Imran<BR><BR>--- On <B>Fri,
8/3/12, CHANDLER DOUGLAS COLEMAN
<I><CHANDLER.D.COLEMAN@stu.mmu.ac.uk></I></B> wrote:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: rgb(16,16,255) 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px"><BR>From:
CHANDLER DOUGLAS COLEMAN
<CHANDLER.D.COLEMAN@stu.mmu.ac.uk><BR>Subject: [postgis-users]
area and distance<BR>To: "postgis-users@postgis.refractions.net"
<postgis-users@postgis.refractions.net><BR>Date: Friday, August 3,
2012, 3:01 AM<BR><BR>
<DIV id=yiv946520484>
<STYLE type=text/css>#yiv946520484 P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</STYLE>
<DIV>
<DIV
style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 10pt">Hello,<BR>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:<BR><BR>SELECT
f.fact_name<BR>FROM factory AS f, inner_area AS i<BR>WHERE i.name =
'Dewsbury'<BR>AND ST_WITHIN (f.geom,i.geom);<BR><BR>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.<BR><BR>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.<BR><BR>Thanks,<BR>Chandler<BR></DIV></DIV></DIV><BR>-----Inline
Attachment Follows-----<BR><BR>
<DIV
class=plainMail>_______________________________________________<BR>postgis-users
mailing list<BR><A
href="/mc/compose?to=postgis-users@postgis.refractions.net"
ymailto="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></DIV></BLOCKQUOTE></TD></TR></TBODY></TABLE></BODY></HTML>