polygon

Check if point is in spatial object which consists of multiple polygons/holes

旧街凉风 提交于 2019-11-26 20:26:56
I have a SpatialPolygonsDataFrame with 11589 objects of class "polygons". 10699 of those objects consists of exactly 1 polygon, however the rest of those objects consists of multiple polygons (2 to 22). If an object of consists of multiple polygons, three scenarios are possible: Sometimes, those additional polygons describe a "hole" in the geographic ara describe by the first polygon in the object of class "polygons". Sometimes, those additional polygons describe additional geographic areas, i.e. the shape of the region is quite complex and described by putting together multiple parts.

Create convex hull polygon from points and save as shapefile

喜你入骨 提交于 2019-11-26 19:54:27
问题 Needing some help re a conversion problem in R. I've got calculated the convex hull of a cloud of points. I'd like, from the points forming the convex hull, to build a polygon object and save that as a shapefile that can be read by a GIS software (ArcMap or the like). My code looks like this: gps <- read.csv(f) ##reads the lat-long coordinates file x <- gps$LONGITUDE ##tells R which columns is which y <- gps$LATITUDE z<-chull(x,y) ##calculates the convex hull --this is just a list of x-y

Google Maps v3: check if point exists in polygon

 ̄綄美尐妖づ 提交于 2019-11-26 19:47:34
I am looking to find a way of checking if a point exists inside a polygon in Google Maps v3 (JavaScript). I've searched everywhere and the only solutions I have found so far have been to do with getting the bounds of the polygon, but the code shown seems to just create a rectangle and keeps expanding its surface area to include all relevant points. By the way, the reason I can't just use a big square i.e. getting a polygons bounds, is that I have bordering polygons on the map and they can not expand into each other's territory. EDIT Following on from the reply below, I have tried implementing

What is the fastest way to find the “visual” center of an irregularly shaped polygon?

心已入冬 提交于 2019-11-26 19:43:22
I need to find a point that is a visual center of an irregularly shaped polygon. By visual center, I mean a point that appears to be in the center of a large area of the polygon visually. The application is to put a label inside the polygon. Here is a solution that uses inside buffering: https://web.archive.org/web/20150708063910/http://proceedings.esri.com/library/userconf/proc01/professional/papers/pap388/p388.htm If this is to be used, what is an effective and fast way to find the buffer? If any other way is to be used, which is that way? A good example of really tough polygons is a giant

Largest circle inside a non-convex polygon

别说谁变了你拦得住时间么 提交于 2019-11-26 19:42:38
How can I find the largest circle that can fit inside a concave polygon? A brute force algorithm is OK as long as it can handle polygons with ~50 vertices in real-time. cletus The key to solving this problem is first making an observation: the center of the largest circle that will fit inside an arbitrary polygon is the point that is: Inside the polygon; and Furthest from any point on the edges of the polygon. Why? Because every point on the edge of a circle is equidistant from that center. By definition, the largest circle will have the largest radius and will touch the polygon on at least

Test of Point inside polygon in Android

孤街浪徒 提交于 2019-11-26 18:22:58
问题 The other day I did a class in Java to calculate if a point(X,Y) is inside a polygon. ( X and Y are double , because will be geo-coordinates). I know that Java has the class Polygon , but I had to use Path2D and Point2D , because Polygon don't allow double 's, just integers :( Once I have the polygon done in Path2D , I used the method contains ( Path2D had it), and my problem was solved. But now, I want to import to Android, and the problem is here, because Path2D needs to import: import java

Polygon Drawing and Getting Coordinates with Google Map API v3 [closed]

拟墨画扇 提交于 2019-11-26 15:21:14
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm trying to develop an application by using Google Maps API v3. What I'm trying to do is; first let the user draw a polygon on a Google Map and get his/her polygon's coordinates and save them into a database. I will then show the user saved coordinates. I don't know how to let users draw polygon on a Google Map

Google Maps API Polygon with “Hole” In Center

故事扮演 提交于 2019-11-26 14:23:07
问题 Inserting a polygon inside another polygon is supposed to make a "hole" in the center (see the Google maps Pentagon example). However, my program keeps failing to make a hole and instead makes two layers of polygon lines insead. http://cl.ly/1c243E1V1G2M1D3H3c0O <-- image of my map Someone said changing the coordinate order fixed their problem so I selected exactly the coordinates of the bermuda triangle as given by Google in their example, however, it had the same problem I encountered

Java- Intersection point of a Polygon and Line

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 14:23:04
问题 Is there any function that will give me the intersection point of a Polygon and Line2D ? I have a Polygon and a line segment that I know intersect I want the actual value of the intersection point not a boolean answer. 回答1: Here you are. The interesting methods are getIntersections and getIntersection. The former parses over all polygon segments and checks for intersections, the latter does the actual calculation. Do keep in mind that the calculation can be seriously optimized and doesn't

OpenCV threshold with mask

时光总嘲笑我的痴心妄想 提交于 2019-11-26 12:45:08
问题 I\'m trying to use OpenCV\'s cv::threshold function (more specific THRESH_OTSU ), only that I\'d like to do it with a mask (any shape), so that the outside (background) is ignored during calculation. Image is single channel (as it must be), red color bellow is only to mark an example polygon on an image. I tried using adaptiveThreshold , but there are a couple of problems that make it inappropriate in my case. 回答1: In general, you can simply compute the threshold using cv::threshold , and