polygon

plotting land with hole using ggplot2

∥☆過路亽.° 提交于 2019-12-05 21:31:37
I have asked about the same issue from here and here , but still can't get my problem solved. I think I need to bring the whole problem and ask for help, rather than breaking it down into small parts. I have a dataframe which I exported it to csv and can be found at http://pastebin.com/SNT9Ykt7 . chart <- ggplot(data=map.shp,aes(x=long,y=lat)) ### PART1 START ### chart <- chart + geom_polygon(data=map.shp,aes(x=long,y=lat,group=id),colour=rgb(162,159,140,maxColorValue=255),fill=rgb(233,235,232,maxColorValue=255),size=0.1) ### PART1 END ### ### PART2 START ### map.group <- unique(map.shp[,

Drawing equidistant points from the sides of a polygon

时光总嘲笑我的痴心妄想 提交于 2019-12-05 21:02:37
I am drawing a polygon with the following vertices x y -0.02208709 -0.039161304 0.01184081 -0.020268029 0.04578401 -0.001351904 0.02210236 0.039176396 -0.01185226 0.020252146 -0.04578784 0.001352696 using the following code plot(x,y) polygon(x,y) points(mean(x),mean(y),col="red") Now I want to plot 50 equally-spaced points along the sides of polygon. Any suggestion how to do it? You can do this with spsample from the sp package. First we'll load the library and read in your vertices. library(sp) xy <- read.table(text='x y -0.02208709 -0.039161304 0.01184081 -0.020268029 0.04578401 -0.001351904

Changing a Polygon's Points

青春壹個敷衍的年華 提交于 2019-12-05 19:12:22
SOLUTION Dynamic Margin on Window Drag So I'm trying to get my polygon to move as the window is moved. I have; private void ResetPolygon(Point Point1, Point Point2, Point Point3) { SpeechPoly.Points.Clear(); ObservableCollection<Point> myPointCollection = new ObservableCollection<Point>(); myPointCollection.Add(Point3); myPointCollection.Add(Point2); myPointCollection.Add(Point1); foreach (Point p in myPointCollection) { SpeechPoly.Points.Add(p); } } private void Window_LocationChanged(object sender, EventArgs e) { if (this.IsLoaded) { Point Point1 = new Point(newPoint3); Point Point2 = new

PHP - Mask polygon over image

馋奶兔 提交于 2019-12-05 18:53:32
Hi Everyone (this is my first post), I am trying to figure a way of cropping a polygon out of an image. I have been reading other similar code. It seems that most code is based around the following process: Resize the image to fit the width and height of the polygon shape, Create a blank image of an unusual colour the same size, Overlay transparent pixels in the shape of the polygon, Overlay that on to the resized image Set the unusual colour to be transparent... My problem is I do not want the code to be reliant on the unusual colour not being in the original image. Does anyone have a better

How can I listen for the start of a user drawing a polygon in Google Maps v3?

痞子三分冷 提交于 2019-12-05 18:29:22
There's a polygoncomplete event that is fired, but I'm looking for a polygonstart event. Even an overlaystart event would work for me. When the user starts to draw a polygon, I want to remove any existing polygon on the map. Currently, I have that functionality implemented using the polygoncomplete event. It needs to happen at the start though. My pseudocode thought is to... Listen to click events on the map. onclick, check to see which drawing tool is selected (if that's possible). If polygon tool selected, remove all previous polygons. This would be much easier with a polygonstart event.

Is there an efficient\\easy way to draw a concave polygon in Direct3d

℡╲_俬逩灬. 提交于 2019-12-05 17:29:01
I'm trying to draw a polygon using c# and directx All I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world. I can load the points and draw a convex shape using a trianglefan and drawuserprimitives. This obviously leads to incorrect results when the polygon is very concave (which it may be). I can't imagine I'm the only person to grapple with this problem (tho I'm a gfx/directx neophyte - my background is in gui\windows application development). Can anyone point me towards a simple to follow resource\tutorial\algorithm which may assist me? Direct3D

google maps api v3 rotate a polygon by certain degree

岁酱吖の 提交于 2019-12-05 16:57:43
I am using google maps to allow the user to draw a polygon then using maps APIs and some sort of geometries draw the min bounded square that cover the drawn polygon at angle of 16 degree i.e. the bounded square should bound the whole polygon area AND should be rotated 16 degree with respect to y-axis. your help is highly appreciated Regards This is a complicated problem. I can outline the steps to get you most of the way there: Solution Outline Get the map projection (map.getProjection()) and convert the user polygon to the point plane using projection.fromLatLngToPoint. Rotate the user

Algorithm for fitting 2D polygons in an area?

旧街凉风 提交于 2019-12-05 15:54:10
Is there a standard for this? Algorithm name? Say: I have 10 polygons of different sizes. I have an area of specific size. I want to know how to fill the most polygons in that area, and how they are fitted. Note: Polygons may be rotated depending on the restriction set. One possible name is a Packing Problem . It is related to the Knapsack Problem . These problems tend to be NP-hard, and many require heuristics. If you can constrain the allowed forms of polygons and of the area, there may exist a more efficient algorithm for your special case. You can have a look at "Dancing Links" in

Ray-Polygon Intersection Point on the surface of a sphere

拜拜、爱过 提交于 2019-12-05 12:41:15
I have a point (Lat/Lon) and a heading in degrees (true north) for which this point is traveling along. I have numerous stationary polygons (Points defined in Lat/Lon) which may or may not be convex. My question is, how do I calculate the closest intersection point, if any, with a polygon. I have seen several confusing posts about Ray Tracing but they seem to all relate to 3D when the Ray and Polygon are not on the same Plane and also the Polygons must be convex. sounds like you should be able to do a simple 2d line intersection... However I have worked with Lat/Long before and know that they

How Do I Calculate the Area of a Polygon in a MySQL Database When the Polygon's Points are Lat Longs?

痞子三分冷 提交于 2019-12-05 11:37:59
How do I calculate the area of a polygon stored in a MySql database? The polygons' points are lat longs. So, degrees and minutes seem to be causing a problem. I've tried: SELECT AREA( my_polygon ) FROM `my_table` WHERE name = 'Newport' Because, the points are lat longs, I get weird results. (I'm not able to switch to Postgre). Is there a way to do this in MySQL? I'd like to get the results in sq. meters or sq. km or sq. miles-- any of these would be fine. You've got to transform those lats and lons into a more appropriate coordinate system. Since the earth is a sphere, you're talking about