# How to Check if a Point is Inside a Polygon in Cesium (Including 180° Meridian and Poles)

**URL:** <https://community.cesium.com/t/how-to-check-if-a-point-is-inside-a-polygon-in-cesium-including-180-meridian-and-poles/40095>\
**Category:** CesiumJS\
**Created:** [April 18, 2025, 12:12pm UTC](https://community.cesium.com/t/how-to-check-if-a-point-is-inside-a-polygon-in-cesium-including-180-meridian-and-poles/40095 "2025-04-18T12:12:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Keei](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/keei/32/28987_2.png) [@Keei](https://community.cesium.com/u/Keei)\
**Post date:** [April 18, 2025, 12:12pm UTC](https://community.cesium.com/t/how-to-check-if-a-point-is-inside-a-polygon-in-cesium-including-180-meridian-and-poles/40095/1 "2025-04-18T12:12:59Z")

</div>

In Cesium, given a set of latitude and longitude points that form a polygon with entity appearances as shown in the figure, if I specify a point P, how can I determine whether this point lies inside the polygon? Does this method remain applicable when the polygon crosses the 180-degree longitude line or contains polar points?

 ![image](https://global.discourse-cdn.com/cesium/original/3X/6/4/6495602507867e621594e3942e34f2d1d180688e.jpeg)

> **[Cesium Sandcastle](https://sandcastle.cesium.com/#c=bVFBbsIwEPzKKqcgpQ4RcKEBtYJKPVRq1Uq9JBxMshCrjh3ZDihF/L1OTFDacrJnd2bHs86k0AYODI+oYAECj7BCzeqSfHY1P/WyDq+kMJQJVKk3uk8FQNYpMylVzgQ1qK08aRsAyXQWwHS8CS4wmvzGd/8KfwQX2KLNwKySmhlmr9ZqYExKWvkdhsXSTYA+xYoqy2BUTMhOyXKNe4WoHTuxhm5OEm1GrXCYTKGuuYmsldsOQWGsu7Wjee6fnE8lebOXYg6n3rdgqKjKimY+XOab4z33Tf8aZRT0ytJmUYzy+fXtkktF3p/W5MhM8cirgvpjMusV5/Y4t0/2Ai/WpuF4Tf/AykoqA7XiPiGhwbLi7arCbZ19oSGZ1i4rQBwOpXHODsDyxY1vh4xTrW1nV3P+wb4x9ZZxaPn/pFxS+zX71wMqTpuWVkTLF1ckhMShhbeVRkq+pWow2TF+AA)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

---

<div class="post-metadata">

**Author:** ![Luke\_McKinstry](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/luke_mckinstry/32/25557_2.png) [@Luke\_McKinstry](https://community.cesium.com/u/Luke_McKinstry)\
**Post date:** [April 18, 2025, 7:58pm UTC](https://community.cesium.com/t/how-to-check-if-a-point-is-inside-a-polygon-in-cesium-including-180-meridian-and-poles/40095/2 "2025-04-18T19:58:43Z")

</div>

Hi @Keei ,

Thanks for your post.

TurfJS has a function for this.

> [@Polygon Contains Cartographic](https://community.cesium.com/t/polygon-contains-cartographic/9172/2):
>
> There isn’t a built-in way to do this as far as I’m aware, but detecting if a point is inside a polygon is a common graphics operation (you’ll find a few different algorithms if you google that). You could use a library like TurfJS and give it the coordinates of your polygons/points: [https://turfjs.org/docs/#pointsWithinPolygon](https://turfjs.org/docs/#pointsWithinPolygon) What kind of application are you working on?

Would that work for you? Please let us know if not and I would be happy to try and help more.

Thanks,  
Luke

_Register for the [2025 Cesium Developer Conference](https://cesium.com/events/cesium-developer-conference/), June 23-25, Philadelphia._
