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
0
votes
0 answers
Extracting near-boundary points from a lattice convex polygon
I have been given a lattice convex polygon. All I want to do is iterate through all vertices and grab the interior points near it (if possible) and only in 4 directions and of unit distance from the point.How do I do that?
Brief of what I did,
I…

Sathyaram
- 143
- 6
0
votes
2 answers
How can I determine if a location (lat/long) is within a certain polygon with corners that all have a given lat/long as well in Android?
I've searched for a long time and haven't quite found the answer. There are several that come close, but nothing that seems to exactly answer my question! I would like to take a set of coordinates, create a polygon out of them, and determine if a…

Connor
- 1
- 1
- 1
0
votes
1 answer
Is possible to expand the border of a lat/long mysql polygon by x miles or km?
So searching for a point within a polygon is quite simple in mysql, doing something like this:
SELECT * FROM table
WHERE ST_CONTAINS(ST_GEOMFROMTEXT('POLYGON((-72.0429540 42.9949644, -72.0405293 42.9929398, -72.0401645 42.9905541, -72.0353365…

clearmend
- 146
- 1
- 10
0
votes
1 answer
Counting points within each LSOA(polygon)
I am attempting to count the number of points within each LSOA area within London. I have attempted to use the over function although the output does not produce a count of the number of listings per LSOA
The code I have conducted so far is as…

James Todd
- 113
- 1
- 3
- 12
0
votes
2 answers
Convert array of point to polygon
I have array of point with latitude and longitude, from this array generating LineString to display way on road by leaflet.
Now i want to improve code function to detect when user point (received from GPS device):
1) Out from waypoint
2) Position on…

Nikola
- 61
- 5
0
votes
0 answers
How can I implement Point-in-Polygon in Megallan in PySpark?
I have a DataFrame of 30 million longitude and latitudes in NYC. I want to map each coordinate to a census tract and preferably have these census tracts as another column in the DataFrame.
Currently, I am using Shapely and PySpark to achieve this.…

Nbarjest
- 691
- 6
- 9
0
votes
1 answer
MySQL spatial query to find all rows that deliver to set point
I have a table, stores, with thousands of stores that deliver. If i have the lat, lng, and delivery_radius for each store (I can add a point column), what is the most efficient way to query the table to see which stores can deliver to where I stand…

Patrick H.
- 66
- 11
0
votes
1 answer
How to find the covering polygon if I know a point all the lines around it
I have a collection of lines in my diagram and I also have a point. What I want is a collection of lines which will together form a polygon through a ordered traversal. I don't need implementation or anything all I want is someone to direct me…

Prakhar Ganesh
- 117
- 2
- 8
0
votes
1 answer
Suggested pointInPolygon algorithm works counterclockwise only
Once I tested the algorithm explained
here and here, I was as excited as the comments below it.
But after my test cases failed then a lot of debugging and tracing, that I realized it has a condition for it to work properly.
This algorithm needs the…
0
votes
0 answers
Error in using over( spatialPoints, spatialPolygons )
My goal is using the over() function in sp to determine which in which polygon a point exists. I have this error ( Error: unexpected '>' in ">" ) on using:
over(ptsUTM, hex_grid)
where class( ptsUTM ) = "SpatialPoints" and class( hex_grid ) =…

Benjamin Levy
- 333
- 6
- 19
0
votes
1 answer
Ray casting point in polygon test for polygon with ray-aligned edges
I tried using the following code for the Even-Odd Rule from Wikipedia
# x, y -- x and y coordinates of point
# poly -- a list of tuples [(x, y), (x, y), ...]
def isPointInPath(x, y, poly):
num = len(poly)
i = 0
j = num - 1
…

Rufus
- 5,111
- 4
- 28
- 45
0
votes
2 answers
Check whether or not a point is in a polygon (Google Maps API)
So I have a map here
How can I, using Google Maps API, detect whether or not a given coordinate is within that polygon? Is that possible?
Thanks in advance.

Tom
- 1,068
- 2
- 25
- 39
0
votes
0 answers
R: Conditionally Replace Lat/Lons with Values from Shape File (Point in Polygon Analysis)
I'm doing a point in polygon analysis to replace lat/lons that = 0 with county centroid lat/lons from a shape file. Forgive me if this question seems trivial, but I'm new to R and my solutions haven't seemed to work out nor have I found very similar…

awal23
- 51
- 7
0
votes
1 answer
R: Finding point in time zone polygon
I wrote a function to determine if a given lat/lon point falls within a specific polygon from the tz_world.shp file. I pass in lon = -77, lat = 42, which is in New York State. The ID from the 155th entry is 'America/New_York'. But, the use of…

Benjamin Levy
- 333
- 6
- 19
0
votes
1 answer
MySQL Point in Polygon Queries and DB Setup
I am trying to set up a table which consists of regions as POLYGON. I want to be able to query the table to find whether a given POINT lies in any of the stored regions or not.
I read that MySQL spatial extensions provide two types of functions to…

Uday Mittal
- 73
- 2
- 8