ufeliciano

incorrect results with st_intersects

Discussion created by ufeliciano on Jan 23, 2014
Latest reply on Jan 28, 2014 by ufeliciano
Hopefully this is an easy one...

Using st_intersects I'm trying to get the records from a polygon layer which centroids intersect with another polygon layer (administrative boundaries).  So far I managed to get this with the following statement...

Select p.pid,p.oldpid,m.muni,m.region
from parcels p, munici m
where sde.st_intersects(m.shape,sde_centroid(p.shape))=1
and rownum<40;

the results are not correct.  It returned pins that intersect different administratives boundaries but listed to the same boundary.  In other words...

"242-083-125-07";"242-000-007-36";"AGUADILLA";"AGUADILLA"
"197-070-419-10";"197-070-069-49";"AGUADILLA";"AGUADILLA"
"115-092-802-AV";"115-092-802-AV";"AGUADILLA";"AGUADILLA"
"045-100-185-58";"045-000-010-88";"AGUADILLA";"AGUADILLA"
"";"115-092-802-15";"SAN JUAN";"AGUADILLA";"AGUADILLA"
"168-005-001-20";"168-005-001-20";"AGUADILLA";"AGUADILLA"

I tried the same in my Postgis database (not using ESRI) and the results appear to be correct.  I used the following in postgis...

SELECT p.pid,p.oldpid,m.muni,m.region
FROM parcels p,munic m
WHERE st_intersects (m.geom,st_centroid(p.geom)) limit 38;

results:

"242-083-125-07";"242-000-007-36";"JAYUYA";"PONCE"
"197-070-419-10";"197-070-069-49";"AGUAS BUENAS";"CAGUAS"
"115-092-802-AV";"115-092-802-AV";"SAN JUAN";"SAN JUAN"
"045-100-185-58";"045-000-010-88";"AGUADILLA";"AGUADILLA"
"";"115-092-802-15";"SAN JUAN";"SAN JUAN"
"168-005-001-20";"168-005-001-20";"COROZAL";"BAYAM�?N"

Could it be something wrong in the statement or maybe something else???  Any suggestions are appreciated...

Outcomes