Algorithm for determining whether a point is inside a polygon. Normally calculated by counting the number of polygon line segments that a ray from the point intersects.
Questions tagged [point-in-polygon]
275 questions
11
votes
2 answers
Check if point is in polygon with Google Maps API in Android
I am using the Google Maps API on Android to create a puzzle. This link contains the data I used to draw African countries: World countries coordinates.
When the user clicks on the map, a test is done to check whether it was in the right country or…

PhiloJunkie
- 1,111
- 4
- 13
- 27
11
votes
2 answers
Point in polygon on Earth globe
I have a list of coordinates (latitude, longitude) that define a polygon. Its edges are created by connecting two points with the arc that is the shortest path between those points.
My problem is to determine whether another point (let's call it U)…

MateuszPrzybyla
- 897
- 8
- 17
10
votes
2 answers
Search a table for Point in Polygon using MySQL
I have create a table (municipal_border), in MySQL 5.5, that holds some boundaries.
CREATE TABLE `municipal_border` (
`boundary` polygon NOT NULL,
`municipalID` int(10) NOT NULL,
) ENGINE=InnoDB
The field municipalID is not unique.
I'm using…

Pavlos Papanikolaou
- 593
- 2
- 7
- 23
9
votes
1 answer
How to draw a polygon overlay using MapKit and swift
I am trying to get the following code to draw a polygon on the map but for some reason it doesn't work. What did i go wrong here?
import UIKit
import MapKit
class ViewController: UIViewController {
@IBOutlet weak var mapView: MKMapView!
…

Sicong Liu
- 113
- 1
- 2
- 7
9
votes
4 answers
shapely and matplotlib point-in-polygon not accurate with geolocation
I am testing the point-in-polygon function with matplotlib and shapely.
Here is a map contains a Bermuda triangle polygon.
Google maps's point-in-polygon functions clearly shows testingPoint and testingPoint2 are inside of the polygon which is a…

Chung
- 1,063
- 1
- 13
- 21
7
votes
2 answers
Point in Polygon check with SVG and JavaScript?
I have a map that I converted from a raster graphic into an SVG file by converting the differently coloured areas into paths.
I know how to do a basic point-in-polygon check given an array of edges, but the svg:path elements represent multiple…

Alan Plum
- 10,814
- 4
- 40
- 57
7
votes
2 answers
Data set creation for eventual integration into MySQL & Google Maps API for a website? (a la point-in-polygon, collision theorem, etc)
I've managed over the past few months to teach myself PHP, PDO & SQL, and have built a basic dynamic website with user registration/email activation/ and login logout functionality, following PHP/SQL best practices. Now I'm stuck on the next task...…

marked-down
- 9,958
- 22
- 87
- 150
7
votes
5 answers
algorithm to define a geofence and see if a point is inside/outside it
I am looking for an algorithm through I can create a geofence and check if a device is entering/leaving the fence. I have looked at point in polygon algorithms (ray casting and winding number) but are there any algorithms which can be applied to…

Nilgiri
- 71
- 1
- 1
- 3
6
votes
3 answers
Point-in-polygon for a large number of points
I'm wondering what may be the most efficient way of determining whether a large number of points (O(1 million) are inside or outside a collection (O(10)) of polygons? The latter are not necessarily convex, but do not have holes in them. At the…

Mogget
- 61
- 1
- 2
6
votes
1 answer
Is there a more efficient way to detect polygon overlap/intersection than PathGeometry.FillContainsWithDetail()?
I have a method that is gobbling up 25% of my cpu time. I call this method about 27,000 times per second. (Yup, lots of calls since it's updating frequently). I am wondering if anybody knows a faster way to detect if 2 polygons overlap. …

Curtis
- 5,794
- 8
- 50
- 77
5
votes
1 answer
d3.polygonContains always returns false
In my react application, I've drawn a polygon by using some points and then I'm trying to find out if mouse current location is inside the polygon or not. I'm using d3.polygonContains and passing it points array with current location points but it…

Naila Akbar
- 3,033
- 4
- 34
- 76
5
votes
2 answers
Mysql: ST_Contains with borders to detect if multipolygon contains point
I use mysql spatial functions.
I have to understand if points lies withing multipolygon.
Initially I used MBRContains but it works in a strange way, so I faced the following error: Mysql function MBRContains is not accurate
My next step was…

gstackoverflow
- 36,709
- 117
- 359
- 710
5
votes
1 answer
Should point on the edge of polygon be inside polygon?
Recently I've faced with one little but majour problem: is point on the edge of polygon be inside polygon?
What I mean - currently I am trying to implement 2D geometry library in JS for custom needs and there is method, lets say…

Kurz
- 393
- 4
- 13
5
votes
2 answers
Delete holes in a Polygon
I have a polygon determined by an Array of Points.
This polygon is crossing itself making some holes in the polygon itself.
My questions is: How can I omit this holes and just get the exterior points of the polygon?
Or what will be the same and…

roger
- 53
- 1
- 3
5
votes
3 answers
Check if dbgeometry dbgeometry/dbgeography point is within a polygon
I have a problem I hope you guys can help me solve.
I have got a DbGeometry point (or DbGeography, I can use both) and I would like to check if this is within a DbGeometry Polygon (alternatively a DbGeography).
I am doing this at the moment:
var…

Manuel Maestrini
- 409
- 6
- 15