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
0 answers
Finding pixel closest (grid points) to rectilinear polygons
I have rectilinear polygons present, and they are surrounded by grids(grey rectangle with dots denoting center) as shown in the diagram below.
The grids are perfectly stacked horizontally and vertically.
I have with me the coordinates of the edges…

kil47
- 53
- 1
- 9
1
vote
1 answer
point in polygon std::bad_alloc error in terra
I am trying to do a point in polygon analysis
This is my polygon
my_poly
class : SpatVector
geometry : polygons
dimensions : 2791790, 35 (geometries, attributes)
extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
coord. ref. :…

89_Simple
- 3,393
- 3
- 39
- 94
1
vote
3 answers
Work out LatLng distance from LatLng (or point in circle) - Google Maps v3
I need to find out if certain LatLngs are inside a Google Maps Circle (one of these: http://code.google.com/apis/maps/documentation/javascript/overlays.html#Circles). How would I get around doing this? My markup for making the circle is:…

rickyduck
- 4,030
- 14
- 58
- 93
1
vote
0 answers
Find Point in polygon javascript
I found this solution in php : Find Point in polygon PHP
I change it in javascript
if (is_in_polygon(points_polygon, vertices_x, vertices_y, longitude_x, latitude_y)){
console.log("Is in polygon");
}
else console.log("Is not in polygon");
…

alice
- 41
- 2
1
vote
1 answer
GeoJSON and MuliPolygon: shape polygon data into dataframe (python, shapely)
I have to find if the point belongs to an area. Information is given by geojson file.
I created DataFrame by:
choro = pd.concat([pd.DataFrame({'name':block['properties']['name'], 'area': shape(block['geometry'])}) for block in geojson['features']],…

OcMaRUS
- 329
- 3
- 13
1
vote
1 answer
Winding algorithm and floating point error
I have written a Java implementation of the winding algorithm for solving the point in polygon problem.
This is the code:
public boolean isPointInsidePolyline(final Vec3D pt) {
boolean isCw = this.isPolylineClockwise();
float count = 0;
…

leonidasarch
- 85
- 1
- 9
1
vote
1 answer
How to find all points within a polygon to create choropleth map?
I am new to R and having a bit of trouble working with two sp data frames.
Data Frames:
'violence' (which is a data frame containing instances of violent occurrences, listed by longitude and latitude)
'DRC_GEO2' (which is shapefile that includes…

aflac205513
- 13
- 4
1
vote
1 answer
How to determine if a Point is inside of a 2D Polygon that has Arcs
I have been using the following references to try to determine if a Point is inside of a 2D Polygon that has Arcs:
Is a point inside of 2D polygon, no curves
Is a point inside a compound polygon (C#)
Is a point inside a curve (Theory)
My approach…

wisenickel
- 346
- 4
- 16
1
vote
1 answer
What kind of algorithm do I need to find out the best path to expand a polygon to capture the most points?
I'm trying to find the best way to expand a polygon to contain the most points. A simple greedy algorithm might be to expand with a 1km square, placing the square at the border in a location that captures the most points at that step. But what if I…

Ben Hendel
- 141
- 6
1
vote
0 answers
Check which geopoints are in which polygon
How to efficiently assign a point a polygon's column value when there are many points?
This is an extention (many to many version) of the question found here: Check if a geopoint with latitude and longitude is within a shapefile
I have a set of…

user2432218
- 23
- 6
1
vote
1 answer
While point in polygon plot points/lines fails (Circle.contains_point; Python; matplotlib; pyplot)
My task: Plot an initial point and calculate new point positions (x, y) while points are in a circle.
My problem: Using a while loop to perform this fails to run the code block as it incorrectly determines the circle doesn't contain the point (fig…

Buzz B
- 75
- 7
1
vote
1 answer
how to find coordinates of all points between multiple points?
As in the question I have several points, lets call them A, B, and C (but they can be more) of which I know the position in (x, y). I also have a defined area ranging in between [1-n] on both axis. I need to find all the points that fall in the…

gabt
- 668
- 1
- 6
- 20
1
vote
1 answer
Point-in-Polygon but coordinate system off even when set to same CRS
I have a tibble with coordinates and I want to see which observations fall into which counties. I am using NHGIS county boundaries:
> counties = st_read("path/US_county_2012.shp", stringsAsFactors = FALSE)
When I use "st_crs()" to extract the CRS,…

ihatecomputers
- 73
- 1
- 5
1
vote
1 answer
Convert Column to Polygon in Python to perform Point in Polygon
I have written Code to establish Point in Polygon in Python, the program uses a shapefile that I read in as the Polygons.
I now have a dataframe I read in with a column containing the Polygon e.g…

Helena Viljoen
- 19
- 4
1
vote
1 answer
Winding Number Algorithm Not Yielding Expected Result
So I've implemented a very unoptimized version of the Winding Number and Crossing Number algorithms found at http://geomalgorithms.com/a03-_inclusion.html, but I've come across a case where the Winding Number algorithm fails to yield the expected…

Ian Clayman
- 21
- 1
- 3