开发者

Point on Polygon (Longitude/Latitude) in .NET [duplicate]

This question already has answers here: Closed 10 years ago.

Possible Duplicate:

Point in Poly开发者_C百科gon aka hit test

I need some help for my problem ;): I've got a polygon definied with 3 or more longitude/latitude points. Now I've got another longitude/latitude point and I need to check if this point is in the polygon area or not.

I need this function in .NET. Can anyone help me?

Thank you very much for your help.


Here is one answer: http://alienryderflex.com/polygon/

You could also use Microsoft's Geometry classes. Create two geometries (one point, one polygon), then do an Intersection of them. If there is an intersection

http://msdn.microsoft.com/en-us/library/system.windows.media.combinedgeometry.geometrycombinemode.aspx

If these methods take too long, you could first wrap the polygon in a bounding box and test if the point is within the min/max lat/long of the box

Note: If your polygon crosses international dateline you may need to add additional code up front before these tests (i.e. add 360 degrees to longitude of polygon's vertices and to point if the longitude is negative so the algorithms work).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜