MapWindow 4 - ActiveX Control Programming : MapWindow Discussion Forum
Need help on how to determine if a point is inside/intersects with a polygon. Just determine if it's &quot;true&quot; or &quot;false&quot;...
Determine if a point is inside a polygon...
Posted by: dominic02 ()
Date: February 22, 2011 01:16AM

Need help on how to determine if a point is inside/intersects with a polygon. Just determine if it's "true" or "false"...

Re: Determine if a point is inside a polygon...
Posted by: sindizzy ()
Date: February 23, 2011 12:19AM

Have you tried the geoprocessing library?

AGP

Re: Determine if a point is inside a polygon...
Posted by: dominic02 ()
Date: February 24, 2011 07:53PM

I haven't checked but I found that comparing extents seems to work fine too. I just compare the extents of the polygon and the point I wanted. I found that with the MapWinGIS Reference Guide

Edited 1 time(s). Last edit at 02/24/2011 07:56PM by dominic02.

Re: Determine if a point is inside a polygon...
Posted by: sindizzy ()
Date: February 26, 2011 08:02AM

That may not always work. imagine a polygon in the shape of a "C" and your point is in the middle. the extents of the "C" are larger than the extents of the point so your algorithm would return true when in reality the point is not inside the polygon.

AGP

Re: Determine if a point is inside a polygon...
Posted by: nmb100 ()
Date: March 02, 2011 03:13AM

Hi

Why not use the shape1.intersects(shape2) function, which results in a boolean response? This will allow you to determine if the point is inside or not.

Hope this helps.

Cheers,
Nigel

Re: Determine if a point is inside a polygon...
Posted by: dominic02 ()
Date: March 04, 2011 10:57PM

To sindizzy and Sir Nigel:

Sorry for the late reply. You were right and saved me a ton of trouble: I almost presented my work to the boss and scheduled a demo! Thank You.

It's fun working on this geoprocessing stuff, though I'm still a noob at it, even with two months experience...

Edited 1 time(s). Last edit at 03/04/2011 10:58PM by dominic02.

Re: Determine if a point is inside a polygon...
Posted by: nmb100 ()
Date: March 16, 2011 07:26AM

Hi Dominic

No problem at all. I am often struggling with how to do things and more often than not, someone has had a similar problem. The forums here are great and have knowledgable people assisting. Paul and Sergei are great.

Nigel

Re: Determine if a point is inside a polygon...
Posted by: dominic02 ()
Date: March 30, 2011 01:36AM

To Sir Nigel

Hi, again. I just want to ask if there is any other way to do this?

Re: Determine if a point is inside a polygon...
Posted by: bmarch ()
Date: April 28, 2011 11:03AM

Hi Dominic,

You can also use:

MapWinGeoProc.Utils.PointInPolygon(...)

Brian M.

Sorry, only registered users may post in this forum.

Banner Exchange