# how to find number of contour lines intersecting with plotted polygon

**URL:** <https://community.cesium.com/t/how-to-find-number-of-contour-lines-intersecting-with-plotted-polygon/7226>\
**Category:** CesiumJS\
**Created:** [July 30, 2018, 7:15am UTC](https://community.cesium.com/t/how-to-find-number-of-contour-lines-intersecting-with-plotted-polygon/7226 "2018-07-30T07:15:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharavath](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dharavath](https://community.cesium.com/u/Dharavath)\
**Post date:** [July 30, 2018, 7:15am UTC](https://community.cesium.com/t/how-to-find-number-of-contour-lines-intersecting-with-plotted-polygon/7226/1 "2018-07-30T07:15:52Z")

</div>

\*\*I have gone through the cesium API’s to find number of contour lines intersecting with the polygon line. But am not able to achieve that… \*\*

[![](https://lh3.googleusercontent.com/-wylU4iXazh0/W166nDRa5TI/AAAAAAAAM5M/hdheEi6b8cQ_7Duu6gX7aze0CsSiW_yswCLcBGAs/s320/counter%2Bline.png)](https://lh3.googleusercontent.com/-wylU4iXazh0/W166nDRa5TI/AAAAAAAAM5M/hdheEi6b8cQ_7Duu6gX7aze0CsSiW_yswCLcBGAs/s1600/counter%2Bline.png)

**Can someone give any idea, how can i know no.of lines intersecting with the polygon line…**

**Need partial code of its implementaion…**

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [July 31, 2018, 6:31pm UTC](https://community.cesium.com/t/how-to-find-number-of-contour-lines-intersecting-with-plotted-polygon/7226/2 "2018-07-31T18:31:47Z")

</div>

Hey Madar,

I don’t think there’s anything built-in to CesiumJS to do this. How are the lines constructed? If you have all the segments, you can try iterating over them (as an array or perhaps as a spatial data structure for efficiency) and implement something like a [line-line intersection](https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect) test.

Best of luck!

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [July 31, 2018, 6:33pm UTC](https://community.cesium.com/t/how-to-find-number-of-contour-lines-intersecting-with-plotted-polygon/7226/3 "2018-07-31T18:33:47Z")

</div>

This class might also be helpful: [https://cesiumjs.org/Cesium/Build/Documentation/IntersectionTests.html](https://cesiumjs.org/Cesium/Build/Documentation/IntersectionTests.html)
