2

I need some function which make the same as ST_MakeEnvelope from PostGIS to use on a SqlServer DB. I need to get only some points from a geometry column to make my application run faster.

1

1 Answer 1

1

I solved the problem using the following code

DECLARE @g geometry; SET @g = geometry::STGeomFromText('POLYGON ((-43.93606328159918 -19.78099695243067, -43.93606328159918 -19.781697344263762,-43.93457465559592 -19.781697344263762, -43.93457465559592 -19.78099695243067, -43.93606328159918 -19.78099695243067))', 0);

SELECT [geometry] FROM [db].[TABLE] WHERE @g.STOverlaps([geometry]) = 1;

the points of the polygon I got using calculateExtent from openlayers following this rule

xmin ymax, xmin ymin, xmax ymin, xmax ymax, xmin ymax

I hope this help someone in the future

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.