<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav" -->

---
title: How To Find Points Contained in a Polygon Using MySQL
description: MySQL 5.7 introduced significant GIS capabilities including spatial indexes for InnoDB and functions like ST_Distance_Sphere and ST_CONTAINS. This walkthrough...
canonical: https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How To Find Points Contained in a Polygon Using MySQL | daily.dev
og:description: MySQL 5.7 introduced significant GIS capabilities including spatial indexes for InnoDB and functions like ST_Distance_Sphere and ST_CONTAINS. This walkthrough...
og:url: https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav
og:image: https://api.daily.dev/og/posts/gckDG4eav.png
og:image:alt: How To Find Points Contained in a Polygon Using MySQL
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How To Find Points Contained in a Polygon Using MySQL

**[Marc G Gauthier](https://daily.dev/sources/marcgg)** · 3 min read · 0 upvotes · 0 comments

## Summary

MySQL 5.7 introduced significant GIS capabilities including spatial indexes for InnoDB and functions like ST_Distance_Sphere and ST_CONTAINS. This walkthrough demonstrates how to store geographic points using MySQL's Point type, filter locations by proximity using ST_Distance_Sphere, and perform precise polygon containment queries using ST_CONTAINS to determine whether a point falls within a defined geographic boundary. A practical example checks whether places are within Paris using both distance-based and polygon-based approaches.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://marcgg.com/blog/2017/03/13/mysql-viewport-gis/>

## Similar posts on daily.dev

- [PostGIS Performance: Intersection Predicates...](https://daily.dev/posts/postgis-performance-intersection-predicates--qvmouzxcq) · Crunchy Data · 0 upvotes · 0 comments
- [PostGIS Performance: Improve Bounding Boxes...](https://daily.dev/posts/postgis-performance-improve-bounding-boxes--zcjfqb3vi) · Crunchy Data · 1 upvotes · 0 comments
- [Hyper-Local Geospatial: Snowflake Hybrid Tables & H3 Unlock Blazing-Fast Geospatial Point-in-Polygon](https://daily.dev/posts/hyper-local-geospatial-snowflake-hybrid-tables-h3-unlock-blazing-fast-geospatial-point-in-polygon-rprj6oipg) · Snowflake Community · 0 upvotes · 0 comments
- [PostGIS Performance: Indexing and EXPLAIN](https://daily.dev/posts/postgis-performance-indexing-and-explain-fmb4tskgj) · Crunchy Data · 1 upvotes · 0 comments

---

Tags: [#backend](https://daily.dev/tags/backend), [#sql](https://daily.dev/tags/sql), [#mysql](https://daily.dev/tags/mysql), [#gis](https://daily.dev/tags/gis)

[View this post on daily.dev](https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How To Find Points Contained in a Polygon Using MySQL","url":"https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav"},"datePublished":"2026-03-26T08:35:52.188Z","dateModified":"2026-03-26T08:36:42.344Z","description":"MySQL 5.7 introduced significant GIS capabilities including spatial indexes for InnoDB and functions like ST_Distance_Sphere and ST_CONTAINS. This walkthrough...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b934abfc104c13c11154bd01ecd294a6?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b934abfc104c13c11154bd01ecd294a6?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Marc G Gauthier","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Marc G Gauthier","logo":"https://media.daily.dev/image/upload/s--P4lsZKFE--/f_auto,q_auto/v1774514113/logos/marcgg?_a=BAMAMiWQ0","url":"https://daily.dev/sources/marcgg"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-find-points-contained-in-a-polygon-using-mysql-gckdg4eav","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"backend,sql,mysql,gis","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Marc G Gauthier","item":"https://daily.dev/sources/marcgg"},{"@type":"ListItem","position":3,"name":"How To Find Points Contained in a Polygon Using MySQL"}]}
```

