How to know a Point belong to a Area of the Layer?!
hungqnx
Global Mapper User
I don't know what function use to check a Point belong to a Area of the Layer?
Can u help me?!
Thank!
Can u help me?!
Thank!
Comments
-
Are you referring to doing this using the SDK? There is not currently a function in the SDK to test a point to see if it is in an area feature, but there well known algorithms that a quick Google search should turn up for doing a point-in-polygon operation. I can point you at one if you need one.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Could u tell me that algorithms?
Thanks! -
Here is some simple C code with the algorithm from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html:
int i, j, c = 0;
for (i = 0, j = nvert-1; i < nvert; j = i++) {
if ( ((verty>testy) != (verty[j]>testy)) &&
(testx < (vertx[j]-vertx) * (testy-verty) / (verty[j]-verty) + vertx) )
c = !c;
}
return c;
}
Categories
- 13K All Categories
- 5.8K Features Discussion
- 351 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 652 GM Script Language
- 56 User Scripts
- 115 GPS Features
- 423 Projection Questions
- 837 Raster Data
- 1.4K Vector Data
- 6.7K Support
- 183 Announcement and News
- 944 Bug Report
- 565 SDK
- 1.2K Suggestion Box
- 3.8K Technical Support
- 583 Other Discussion
- 132 GIS Data Sources
- 27 Global Mapper Showcase
- 246 How I use Global Mapper
- 111 Global Mapper Forum Website
