polygon

Determine if Polygon is Within Map Bounds

不问归期 提交于 2019-12-09 19:00:54
问题 I have a big list of polygons (consisting of google maps polygon options) which I would like to check if they are within the bounds of the screen before drawing them. How do I determine if the polygon is within the screen bounds. Something like this: List<PolygonOptions> polygons = getPolygons(); LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds; for (int l = 1; l <= polygons.size(); l++) { if (bounds.Contains(polygons.get(l))) { map.addPolygon(polygons.get(l)); } }

line simplification algorithm: Visvalingam vs Douglas-Peucker

微笑、不失礼 提交于 2019-12-09 16:01:23
问题 I am trying to implement a line simplification algorithm . The main 2 algorithms I found are: Ramer-Douglas-Peucker Visvalingam-Whyat Currently I am running a few simulations of them on Matlab in order to determine which answers my needs better. The main goal for the algorithm is to simlipfy polygons in a map. My Input is a polygon\polyline and a threshold for mistake- epsilon. I need the simplified polygon to be as close as possible to the original, and I do not have a requirment for number

Computing a polygon that surrounds a multi-point line

自古美人都是妖i 提交于 2019-12-09 13:13:27
问题 I am trying to compute a polygon that surrounds a line connecting multiple points (e.g. a GPX track). The image below shows an example with the track as red line and the desired polygon in blue. As simplification the red points are denoted by x and y - not by latitude/longitude. How do I compute such an environment (light blue polygon) if I only have the list of the three points specifying the path? Partial solutions (e.g. for only two points) or hints about mathematical libraries (in Java)

Android How to draw a regular polygon via xml or programical

帅比萌擦擦* 提交于 2019-12-09 06:39:53
问题 Is there any way to draw polygonal shapes on Android xml layouts? or is any helper class as library to draw them? 回答1: I am using enhanced version of this Class See working sample on GitHub (https://github.com/hiteshsahu/Benzene) Drawable Class import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.drawable.Drawable; /** * Originally Created by AnderWeb (Gustavo

How can I form polygons from lines

*爱你&永不变心* 提交于 2019-12-08 14:42:23
I have a bunch of 2-dimensional lines, whose start and end points are known. The lines might occasionally cross each other, or one line might end in the middle of another line. I need to form polygons from this mesh of lines. If necessary, I can ensure that the left side of all lines are inside their polygons. What you're describing is what we called "parcelization" or "spaghetti cutting", and then "polygonization" when I worked for GeoVision. Basically you want to cut the lines where-ever they intersect other lines and themselves, and then you want to assemble them into polygons by traversing

geoxml3 kml polygon tooltip on mouseover instead of click

你。 提交于 2019-12-08 12:54:26
问题 I need an working example or a solution for hovering a kml polygon and showing the info balloon - instead of doing it on click. Is it doable? For example, on this map, instead of showing the info balloon on click, doing it on mouse over: http://www.geocodezip.com/geoxml3_test/geoxml3_test_polygon.html Obs.: my kml file has additional info inside Placemark => ExtendedData (if that helps in any way). tks :) 回答1: Here is an example that uses InfoBubble for the "tooltip" (only handles polygons):

Interactive change of KML Polygons Style in Google maps

笑着哭i 提交于 2019-12-08 12:48:27
问题 I have a database with KML Plolygons representing german postal regions. I initialize the map like this to get the polygons displayed. var map = new google.maps.Map(document.getElementById("map"), mapOptions); var plzLayer = new google.maps.KmlLayer({ url: 'http://xxxxx.de/index.php?option=com_map&task=kml.getplz&search=542', map: map }); Everything works like a charm. I can even style the Polygons by defining styles in the kml file. My question is; how can I change the style of polygon

Algorithm to make a polygon from transparent png sprite

假如想象 提交于 2019-12-08 08:32:38
问题 Say, I have a sprite of a game object which is a png image with transparency. I want to create a polygon from this image which will contain my game object. I am pretty sure there is an existing algorithm for it, but I haven't found any. I expect something like: public static Polygon getPolygon(BufferedImage sprite) { // get coordinates of all points for polygon return polygon; } 回答1: See this question. It will be slow, but it depends on how accurate you want it (second answer is sloppier, but

Sorting vertices of a polygon in CCW or CW direction

我与影子孤独终老i 提交于 2019-12-08 08:21:38
问题 I really need some urgent help with this problem. I have a set of edges and vertices defining a polygon (not necessarily convex). The vertices and edges are in random order and I want to sort/order the vertices of this polygon in clockwise (or anti-clock wise) direction. please see this page for more detailed description: http://www.dixittech.com/blog/2012/10/28/sorting-vertices-of-a-polygon-in-ccw-or-cw-direction/ Any idea how this can be achieved? 回答1: I think this is a simplified version

Why polygon in R works with a full curve but not with a half curve?

早过忘川 提交于 2019-12-08 08:10:03
问题 I'm wondering why polygon() works very well with a two-sided curve ( bottom picture ), but not working correctly with a half of that same curve ( top picture )? I appreciate a short explanation. par(mfrow = c(2, 1)) gg = curve(dnorm(x), -4, 0) # Not working! polygon(gg, col = 2) gg = curve(dnorm(x), -4, 4) # Working! polygon(gg, col = 2) 回答1: One curve Since polygon connects the start and the end of your curve, it creates some weird shape. From ?polygon we can see that "It is assumed that the