Questions tagged [point-in-polygon]

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.

275 questions
0
votes
1 answer

How to use leaflet-pip plugin with pure GeoJSON data?

I have trouble with using leaflet-pip: i get geojson data from here: http://polygons.openstreetmap.fr/get_geojson.py?id=1320234¶ms=0 How should i call leafletPip.pointInLayer with such data? I have several attempts, but it returns empty array,…
Kirill
  • 67
  • 9
0
votes
1 answer

Given a Shapefile, understand in which polygon a point is

Given a set of points (latitude and longitude) in the area of Milan,Italy I want to decide to which "neighborhood" each point belongs Here is what I have…
mariob6
  • 469
  • 1
  • 6
  • 16
0
votes
1 answer

Reading in polygons from a Object File Format (.off) file

I need to read in a list of polygons from a Object File Format (.off) file (in c++). The format of .off files is basically like this: Header infomation x y z //co-ords for each vertex ... NVertices v1 v2 v3 ... vN //Number of vertices for each…
0
votes
0 answers

Weird hole in randomized mapping output

I am uniformly generating points within the contours of Manhattan, using this geojson file. I plotted the result using Bokeh to make sure that my output was looking good, and this is what I got: ...so there is no east side? Here is the full…
Aleksey Bilogur
  • 3,686
  • 3
  • 30
  • 57
0
votes
1 answer

Point inside compound polygon

I have seen many algorithms for point inside polygon. What I learned so far came from this site: http://alienryderflex.com/polygon/ The best algorithm usually look like this: var inside = false; for (int i = poly.Count - 1, j = 0; j < poly.Count; i…
Eric Biron
  • 77
  • 7
0
votes
1 answer

Point in Polygon using leaflet-pip

I'm trying to, given a .json containing a lot of points, determine how many there are in each region (probably returning a dictionary), which are defined in another .json file. I'm doing this based on this…
pceccon
  • 9,379
  • 26
  • 82
  • 158
0
votes
1 answer

How should I send a Polygon with a hole for the Winding number Point in Polygon test?

I want to check if a point is in the Polygon (which can have a hole/holes within it). Right now a polygon with a hole is represented as multiple polygons when the hole and the outside polygon doesn't have a common vertex. Under these circumstances…
0
votes
1 answer

How to find a Point on earth is enclosed by a polygon formed by four points on earth

I'm trying to find out whether a point in lat, lon lie inside a polygon formed by four random points on earth. Can someone help me out with a algorithm with sudo code in java. Thanks in advance.
ardhani
  • 303
  • 1
  • 11
0
votes
1 answer

Java-Algorithm for Polygon-Collision (Point-in-Polygon): Problems with Degenerated @ Boundary

I need for my java-program a function that checks for polygon-collision, but the algorithms (for point-in-polygon) I tried were not correct for my needs, the degenerative cases are a problem for me. This is what i try to reach with my program: I…
E.B.
  • 1
0
votes
0 answers

Is there an algorithm to derive the vertices of a polygon if you have all of the points within?

Say I have two-dimensional grid with evenly-spaced integer coordinates, and each grid position (x,y) can either be ON or OFF. Is there a way to define what shape is created by the ON positions, as a list of vertices of the polygon? With the ON grid…
DashAnimal
  • 935
  • 1
  • 7
  • 10
0
votes
2 answers

Reading line per line, and evaluating strings into coordinates using fgets() and sscanf()

I'm trying to read multiple lines of vertices with varying length using fgets and sscanf. (1,6),(2,6),(2,9),(1,9) (1,5) My program goes into an infinite loop stuck within the first vertex. char temp3[255]; while(fgets(temp3, 255, fp)!=…
gkhnavarro
  • 446
  • 2
  • 14
0
votes
0 answers

Point inside polygon weird results

I want to determine if coordinates are inside a polygon, however I'm getting extra results that are not in the polygon. It's almost like it only checks for if EITHER the lat or lon is in range but not both. Any ideas?? public function…
Aaron
  • 95
  • 12
0
votes
1 answer

Border-Line Cases: MySQL Point-in_Polygon Function Results in Duplicates When the Point is on the Border

I'm using MySQL to pull lat longs from a database and check whether or not they are in a particular neighborhood. Everything works great, except if the point is on the border between two neighborhoods. Then, the point is included in both…
Laxmidi
  • 2,650
  • 12
  • 49
  • 81
0
votes
1 answer

How to check whether a pointsD is within the lines of a polygon python 2.7 (no import)

I saw here a solid algorithm that checks if a point is inside the polygon. def point_inside_polygon(x, y, poly): n = len(poly) inside = False p1x, p1y = poly[0] for i in range(n + 1): p2x, p2y = poly[i % n] if y >…
0
votes
1 answer

Point in polygon - faulty algorithm

I have this C code of an alogrithm checking whether a given point is inside a polygon. It is supposed to be correct, I also keep seeing this code in various places. However when I use it doesn't work perfectly - about 20% of the answers are…
Fryderyk
  • 1
  • 1