Hi all, I'm experimenting with spatial queries in SQL Server 2008. Created an SDE DB with GEOMETRY storage type and loaded several feature classes. I'm trying to select features from a FC intersecting a polygon:
DECLARE @LandUse geometry
='POLYGON ((169394.70008075237 1068417.1000268459 <more coordinates>))'
SELECT SOIL_ID
FROM soils
WHERE Shape.STIntersects(@LandUse)=1
The statement returns no records, although the polygon declared does intersect several features in the soils FC. What am I doing wrong? Thanks, Arnon
Microsoft's documentation states: This method always returns null if the spatial reference IDs (SRIDs) of the geometry instances do not match. You didn't show the SRIDs involved, but that's the most likely cause. - V
The SDE_geometry_columns table shows the same SRID for both feature classes (1). I grabbed the declared polygon by a previous select statement, but in the declaration no SRID explicitly defined. Could that be the problem? Can I specify an SRID? Thanks!
The POLYGON constructor accepts an SRID, but the ArcSDE SRID and Microsoft SRID might be different values. You need to use the Microsoft SRID in the native OGC operators. The ArcSDE sequence-generated SRID is a link to a row in the spatial reference table, where the native SRID resides. - V