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
2
votes
1 answer
Minkowski Sum of 3D(+) convex polygons
My goal is to obtain the representations of all faces (in the form of A[x,y,z]'>b) of a polyhedron that is the result of the convex difference between two convex polyhedra. Meaning, finding the intersection of all planes that are the result of the…

GuyS
- 85
- 6
2
votes
0 answers
Reactjs get SVG Polygon points loaded via image src and place the label text in center / optimal spot
Input can be any SVG Polygon image of different irregular sizes as below
logo.svg
--------
2
votes
1 answer
Color every point in a polygon depending on another dataset of points, in R
Problem:
1.) I have a shapefile that looks like this:
Extreme values for coordinates are: xmin = 300,000, xmax = 620,000, ymin = 31,000 and ymax = 190,000.
2.) I have a dataset of approx. 2mio points (every point is inside the given polygon) - each…

charisa
- 25
- 3
2
votes
1 answer
Generating a filled polygon inside a hyperarray
Consider the following:
Currently, I'm programming a very basic dungeon generator. Right now, it works like this:
Generate an int[][] hyperarray of arbritrary lengths.
Place rooms at random coordinates in this hyperarray (we'll call it maze for…

Ascor
- 33
- 4
2
votes
3 answers
Geo coordinates for a polygon over Germany (or any other region)
I am using java. I want to check wether or not some location lies in germany (it is an application for a company, and its trucks aren't allowed to cross borders).
Now I know, that one can only approximate this, but thats okay, since I mainly want to…

David Lehnherr
- 225
- 1
- 10
2
votes
3 answers
How to drop dataframe rows where X and Y coordinates are outside of polygon
I am trying to address the following issue. Let's assume a dataframe (loaded from a txt file) with the following structure (and thousands of rows):
foo.head()
X Y Z
0 125417.5112 536361.8752 -1750.0
1 127517.7647 …

Red Sparrow
- 387
- 1
- 5
- 17
2
votes
1 answer
Point inside a 2D Polygon
Following piece of java code is a solution to determine whether a 2D Point is within a Polygon or not (taken from here). I think this code has some problems. For example for this polygon:
Point[] polygon = new Point[5];
polygon[0] = new…

hamed
- 23
- 1
- 4
2
votes
1 answer
Point inside polygonal region with polygonal hole
I am using matplotlib.path.Path to check whether a set of points are inside a region bounded by polygons (polygonal region with a polygonal hole). My approach involves two checks and a loop:
import numpy as np
from matplotlib import path
# Define…

Numaerius
- 383
- 3
- 10
2
votes
2 answers
Using matplotlib to solve Point in Polygone
I am looking for an algorithm to check if a point is within a polygon or not.
I am currently using mplPath and contains_point() but it doesn't seem to work in some cases.
EDIT 16 Sept 2016:
Okay so I imporved my code by simply checking if the point…

Sorade
- 915
- 1
- 14
- 29
2
votes
2 answers
how to detect point inside polygon for neo4j, cypher
I have node A with 2 properties lat, lon. :A(lat : 11, lon : 12)
and node B with 1 property polygon. :B (polygon : [[10, 11], [5, 7], [1, 2], ....]). how can I detect is A inside list point of polygon which is property of B??

Ngoc V. Hoang
- 21
- 2
2
votes
1 answer
Point in polygon algorithm that returns true when the test point is on a polygon edge
I've implemented a point-in-polygon algorithm based on http://alienryderflex.com/polygon/.
It works fine but, as it says in the article:
If the test point is on the border of the polygon, this algorithm will deliver unpredictable results
It…

James Bateson
- 1,069
- 13
- 20
2
votes
3 answers
Given a list of GPS coordinates making up a boundary, how can I calculate if my location is within that boundary?
Suppose I have hundreds, or even thousands of GPS coords, Latitude and Longitude that make up a boundary around a country.
I also have my current position Latitude and Longitude.
How can I determine (using C#, programming for Windows10 UWP) if my…

Percy
- 2,855
- 2
- 33
- 56
2
votes
0 answers
Keeping Points on Land and Dropping those on Water
I have several polygons which are actually a union of points. I want a reasonably quick way of removing the points which are not land (but on river, lake, ocean, etc).
So I far I have come up with the below method which takes me from the left…

mptevsion
- 937
- 8
- 28
2
votes
1 answer
Turfjs inside and intersect
I'm trying to determine if a point is inside a polygon using TurfJS.
But I'm getting unexpected results.
In first place, I tested this simple code and works well.
The intersection is true because the point pt0 is one the points in the polygon.
var…

Christian Bouvier
- 433
- 3
- 10
2
votes
1 answer
Efficient way of determining polygon intersection with bounding box
I have a set of polygons, and I need to check whether they are intersecting with a given bounding box(rectangle). What I am doing is, I am taking every vertex of polygon and checking whether it's inside bounding box or not.
If yes
return true …

Aleem Uddin
- 41
- 7