I asked this question on parallel site (h++p://stackoverflow.com)and think this is a better place to ask such questions I want to find all geometries in a table that intersects with spacial geometry using SQL Server, I tried to use this SQL query
DECLARE @g geometry;
set @g=Geometry::STGeomFromText('POLYGON ((578060.3439000080000000 3450265.1968000000000000, 578049.6538000090000000 3450236.4844000000000000, 578030.9746000080000000 3450193.9723000100000000, 577995.7130000080000000 3450133.1654000000000000, 577974.8281000070000000 3450090.7579000000000000, 577811.4680000080000000 3449745.6367000000000000, 577804.8125000080000000 3449733.9653000000000000, 577778.4473000080000000 3449675.1851000000000000, 577769.3170000080000000 3449669.8222000000000000, 577751.0450000080000000 3449674.6951000000000000, 577687.3179000100000000 3449718.1878000000000000, 577667.0708000070000000 3449740.7260000000000000, 577668.7438000080000000 3449750.0009000000000000, 577710.9384000080000000 3449836.2113000000000000, 577735.3070000080000000 3449889.5231000000000000, 577744.7248000080000000 3449902.4691000000000000, 577779.5568000080000000 3449976.3343000000000000, 577794.5004000070000000 3450004.6225000000000000, 577974.2512000080000000 3450373.9550000000000000, 577984.9893000070000000 3450399.4253000000000000, 577987.9717000080000000 3450404.3992000100000000, 578021.4391000080000000 3450432.3046000000000000, 578053.5285000080000000 3450441.3588000000000000, 578085.6470000080000000 3450452.9310000000000000, 578130.7084000080000000 3450465.0823000000000000, 578140.7284000080000000 3450462.3602000000000000, 578132.0483000100000000 3450431.9346000000000000, 578077.0528000090000000 3450304.0990000000000000, 578056.8904000090000000 3450265.6079000000000000, 578060.3439000080000000 3450265.1968000000000000))',32639).MakeValid();
SELECT
p.[owner_ID], p.[OBJECTID] as id,
[Shape], o.[OBJECTID], o.[Name], o.[Family], o.[Father],
o.[owner_id] as oid
FROM
[dbo].[Property] AS p
JOIN
[dbo].[OWNER] AS o ON p.owner_ID = o.OBJECTID
WHERE
[Shape] IS NOT NULL
AND o.idshahrestan = 13
AND [Shape].STIntersection(@g)
but it does not work...Is this even possible using SQL Server? I think for a better preformance If I buffer my shape with a distance around 50m and find intersecting shapes or other with some boundry boxes this worsks better but I don't know how to do that :( I need some hints about this. Thank you for your help
Aucun commentaire:
Enregistrer un commentaire