3

I am trying to find the length of a polyline inside a polygon using this query:

declare @p geometry, @l geometry;

select @l = SHAPE FROM [Vz_DSM_Stationing].[dbo].[Route_Sections] where OBJECTID = 3;
select @p = SHAPE FROM [Vz_DSM_Extra].[dbo].[PERMIT_BOUNDARIES] where OBJECTID = 8;

select @p.STIntersection(@l).STLength();

This query retrieves the shapes correctly, but selects NULL at the final statement.

  • are both geometries in the same CRS? – ThingumaBob Jun 8 '18 at 17:53
  • Yes they are both in 'NAD_1983_StatePlane_Iowa_South_FIPS_1402_Feet' – T Kelly Jun 8 '18 at 18:09
  • Did you try select @l.STIntersection(@p).STLength(); ? – Kirk Kuykendall Jun 8 '18 at 18:19
  • Yeah, that didn't work either. – T Kelly Jun 8 '18 at 18:32
  • What are the Linestring coordinates after STIntersection? – klewis Jun 8 '18 at 18:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.