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
1
vote
2 answers
Determine in which polygon a point is, and then apply the name of that polygon as a new column to a large pandas dataframe
I have a large dataframe containing location data from various ships around the world. imoNois the ship identifier. Below is a sample of the dataframe:
and here is the code to reproduce it:
# intialise data of lists.
ships_data =…

oikonang
- 51
- 11
1
vote
2 answers
How do I determine if a series of points (or polygon) is within a rectangular region?
I have been looking at posts about determining if a point lies within a polygon or not and the answers are either too vague, abstract, or complex for me. So I am going to try to ask my question specific to what I need to do.
I have a set of points…

jpwrunyan
- 530
- 5
- 22
1
vote
1 answer
Plotting pixels and contours when XY coordinates are known
I am using Open CV in python and I extracted some points from contour and pointpolygon test operation. (I basically used pointpolygon test to check if some pixels are inside a contour or not).
Now I got the points but I want to visually confirm if…

PagMax
- 8,088
- 8
- 25
- 40
1
vote
1 answer
create polygon for a route using latitude and longitude
I am having a predefined route as a set of locations with latitude and longitude. I want to create a polygon by using these co-ordinates and want to know when the user deviates from it.
Anyone have any tips or sample code to draw a virtual fence…

Manu
- 269
- 6
- 18
1
vote
0 answers
Point-in-polygon in spatial sql without cross join (oracle with sde)?
I would like to do a point in polygon test using spatial SQL (DBMS Oracle with SDE for spatial tables). I have a spatial, materialized view containing points and I would like to add the polygon ID (from a different table) in which a point lies to…

faebel
- 11
- 1
1
vote
1 answer
Changing polygon points in SVG for radar chart in Microsoft Powerapps
I am developing a radar chart in Microsoft Powerapps. When pressing a button the chart must change. Since radar charts are not supported I create one myself using a SVG image. By pressing the button the SVG polygon points must change so it matches…

Jan Zandbergen
- 13
- 4
1
vote
1 answer
How to determine if a point is existing in only one polygon not in adjacent/other nearby polygon?
I am using an algorithm given here(many others are also using It). But in my scenario for some specific point, it is showing intersections at more than one polygons.
I am using php and imported geojson in mysql. and using below code…

Furquan
- 1,542
- 16
- 20
1
vote
1 answer
Creating a centroid column from geometry shape field produces AttributeError: 'NoneType' object has no attribute 'centroid'
I have imported a shape file of Australian local government areas (LGA's) into google Colab and successfully read into geopandas. The subsequent geodataframe
lga_df = gpd.read_file("LGA_2016_AUST.shp")
has a geometry field with a list of polygons.…

George Deubler
- 31
- 1
- 3
1
vote
1 answer
How To Find a Point In Polygon from a Geojson file Using Python And Geopandas
So I have a .geojson file that contains a FeatureCollection of multiple polygons representing a country. I am trying to determine if a specific point is inside one of these polygons. If so, I return the entire feature itself; if not, I return a…

AllJs
- 1,760
- 4
- 27
- 48
1
vote
1 answer
St_buffer() giving inaccurate results
I have the following code:
set @lon = 121.4732134;
set @lat = 31.2304321;
set @point = point(@lon, @lat);
set @radius = .5;
set @polygon = ST_Buffer(@point, @radius);
select l.city,l.latitude,l.longitude,
st_distance_sphere(l.latlngindex,…

lmao
- 452
- 1
- 5
- 13
1
vote
0 answers
how to efficiently detect and remove non-connecting lines in a shape
I wish to perform a point-in-polygon check but first need to remove redundant lines from the polygon so that I can then carry out a ray-casting algorithm. The polygon is being represented in a 2D binary array (1 for filled, 0 for empty). Redundant…

Philip Eagles
- 888
- 1
- 9
- 27
1
vote
0 answers
How to sort/label points by the polygon that they fall in?
I have a lot of polygons (~40k), each of which represent a different city block. I also have a lot of latitude/longitude coordinate points (~700k). Each polygon is labelled and has a unique name.
Is there a way that I can go through each individual…

Naiem
- 71
- 1
- 5
1
vote
1 answer
GeoJSON : Check if a Geo Coordinate is inside Polygon
I have following GeoJSON data file which contains a polygon with coordinates.
[
{
"geometry": {
"type": "Polygon",
"coordinates":
[
[
[
9.137248,
48.790411
],
…

Arun Kumar
- 6,534
- 13
- 40
- 67
1
vote
1 answer
find out a point is in which polygons
I have a region table in oracle 12c, the table include 9 region that each of them defined by a polygon.
Polygon defined by 4 points in 2D.
I give a point from client and I must find out that this point is in which polygon. can anyone help me with…

navid sedigh
- 279
- 1
- 5
- 15
1
vote
2 answers
How does the Even-Odd Algorithm count polygon edges?
I am wondering how the even-odd algorithm works for identifying a point in a complex polygon.
What I know right now is that it will do the horizontal search from most left to the point and count the number of edges touched.
However, what happens…

Shing Chi Ng
- 31
- 1