polygon

Google Maps v3 - Delete vertex on Polygon

北慕城南 提交于 2019-11-29 19:54:11
Google Maps has the Drawing library to draw Polylines and Polygons and other things. Example of this functionality here: http://gmaps-samples-v3.googlecode.com/svn-history/r282/trunk/drawing/drawing-tools.html I want, when drawing and editing the polygon, to be able to delete one point/vertex on the path. The API docs haven't seemed to hint at anything. Ian Grainger This is currently an outstanding feature request (acknowledged by Google), issue 3760 . Here's my solution: http://jsbin.com/ajimur/10 . It uses a function that adds a delete button to the passed in polygon (below the undo button).

Make clickable polygons on Google Maps (for Android)

爷,独闯天下 提交于 2019-11-29 19:30:59
问题 I have continuous LatLngs of various areas in a city. Is there any way I can create clickable polygons with it. Once way to go about would be to Generate polygons with the available LatLngs.( I want to visually show the polygons on the map with color encoding) Set up setOnMapClickListener . Do a point inside polygon test. I understand that this is very naive. What are the alternative approaches? 回答1: Here's how I did it. Polygon polygon = getMap().addPolygon(new PolygonOptions() .add(new

how to order vertices in a simple, non-convex polygon

给你一囗甜甜゛ 提交于 2019-11-29 17:30:21
I have a problem where I have a series of points for a simple, non-convex polygon (I hope I have the terminology correct). But the points are not necessarily in order (ie, clockwise or counterclockwise). For Flash's drawing API to correctly draw a fill area, I need to have these points progress in order around the edge (to finally connect with the starting point). Is there some way I can sort my list of Cartesian coordinates in either clockwise or counterclockwise direction so I can draw my shape from point to point without "lifting the pen"? I saw one post for sorting 4-points of a polygon,

Area of self-intersecting polygon

时光毁灭记忆、已成空白 提交于 2019-11-29 17:18:54
问题 Calculating the area of a simple irregular polygon is trivial. However, consider the self-intersecting polygon ABCDEF shown at left below: If we use the linked-to formula above traversing the points in polygon order, we get an area of 0. (The 'clockwise' area cancels out the 'counter-clockwise' area.) However, if we sort the points radially around a center and calculate the area, we get the incorrect area of the polygon ABEDCF at right above. How can I best find the visible area of a self

geom_polygon with multiple hole

这一生的挚爱 提交于 2019-11-29 16:12:08
I refer to the answer for this question and have additional question. I have modify the code as below: library(ggplot2) ids <- letters[1:2] # IDs and values to use for fill colour values <- data.frame( id = ids, value = c(4,5) ) # Polygon position positions <- data.frame( id = c(rep(ids, each = 10),rep("b",5)), # shape hole shape hole x = c(1,4,4,1,1, 2,2,3,3,2, 5,10,10,5,5, 6,6,7,7,6, 8,8,9,9,8), y = c(1,1,4,4,1, 2,3,3,2,2, 5,5,10,10,5, 6,7,7,6,6, 8,9,9,8,8) ) # Merge positions and values datapoly <- merge(values, positions, by=c("id")) chart <- ggplot(datapoly, aes(x=x, y=y)) + geom_polygon

Validity of algorithm for creation of a non self-intersecting polygon

烈酒焚心 提交于 2019-11-29 15:25:43
问题 As an extension and partial answer to my thread I wrote a simple algorithm that given a set of points(with xy coordinates) can form a non self-intersecting polygon. Claim: Given an arbitrary set of points with different coordinates it is always possible to construct a regular or irregular, non self-intersecting polygon. The algorithm: Assume there is a set V containing all the vertices 1) Sort all vertices in V by x-coordinate 2) Imagine a straight line (we'll call that "the divider")

How to create a Polygon given its Point vertices?

隐身守侯 提交于 2019-11-29 13:09:46
I want to create a polygon from shapely points. from shapely import geometry p1 = geometry.Point(0,0) p2 = geometry.Point(1,0) p3 = geometry.Point(1,1) p4 = geometry.Point(0,1) pointList = [p1, p2, p3, p4, p1] poly = geometry.Polygon(pointList) gives me an type error TypeError: object of type 'Point' has no len() How to create a Polygon from shapely Point objects? If you specifically want to construct your Polygon from the shapely geometry Points, then call their x, y properties in a list comprehension. In other words: from shapely import geometry poly = geometry.Polygon([[p.x, p.y] for p in

Google Maps API v3 Polygon closing

↘锁芯ラ 提交于 2019-11-29 12:01:48
When creating a polygon using the Google Maps API v3, how can I prevent the polygon from snapping to other 'maps'? So instead of: I would like to make the polygon close like this: The issue occurs when the difference between the longitudes of 2 consecutive points in the path is >=180 the longitudes of the first 2 points are -97 and 93, so that's the problem in this case(difference is 190) The only thing I may suggest so far is to split this portion of the path: new google.maps.LatLng(81, -97), //additional point new google.maps.LatLng(80.5, -12), new google.maps.LatLng(80, 93), new google.maps

Divide self intersecting polygon (C Code)

拈花ヽ惹草 提交于 2019-11-29 11:56:15
I want to divide a self-intersecting polygon into simple polygons. I have the edges and the intersection points saved in a data structure (a connected list). So here is an example. I have a connected list with the x,y coordinates of the edges and the intersection points of the polygon. According to the polygon in this picture it would be :: (1) -> (2) -> (3) ... -> (7). What I'm trying to do is to get the edges of the simple polygons (triangles here). In this case :: 1,2,7 / 3,4,5 / 5,6,7. I would think that Bentley-Ottman would be your best bet. There's a nice interactive visualization here .

Mongodb : Check if a point is inside a stored polygon

房东的猫 提交于 2019-11-29 11:22:06
问题 I'm new to the mongodb geolocation features. I stored some polygons that represent the country borders in a database along with the country name. Now what i would like to do is checking which country a point is in. For example if i give my own geolocation i would like to get the country where i am. Is there a way to do it with mongodb? Maybe with geoWithin? Thank you 回答1: You must store your location data like this schema: {"loc": {"coordinates":[ [ [1.0,1.0], [1.0,10.0], [10.0,10.0], [10.0,1