polygon

Finding the nearest distances between a vector of points and a polygon in R

孤街醉人 提交于 2019-12-13 16:16:18
问题 I have a data frame of lat/long coordinates and a polygon, which represents a coastline. I am trying to find the distance between each point and the nearest coastline feature. I would like to end up with an output data frame that includes columns for my original lat/long values and a new distance column. I have attempted to use the gDistance function after reading answers to similar questions online, but I think that I am missing a few steps and am having trouble figuring it out. At present,

polygon coordinates

回眸只為那壹抹淺笑 提交于 2019-12-13 11:24:55
问题 how can we draw a polygon. when only the sides and radius is given. I have to make a pop up box which will take as input the radius and number of sides and will draw a ploygon. just need the formula. 回答1: Imagine a circle of radius r. It is like a regular polygon with an infinite number of sides. Trigonometry tells us: x = r * cos(a); y = r * sin(a); We know there are 360 degrees or 2pi radians in a circle. So to draw it we would start with angle = 0, calculate that co-ord, step to the next

Get geocoding informations from a polygon

三世轮回 提交于 2019-12-13 06:34:43
问题 I'm making an application in which the user can draw a polygon on a google map, and get its coordinates and save them. Well i a have accomplished all this. But what i want to do now is to extract the geocoding informations(streets, addresses ...) from that polygon, i know how to make the reverse geocoding for a given Lat/Lng but my question is how i can do it with a polygon ? This is my code : <script src="https://maps.googleapis.com/maps/api/js?v=3.20&callback=initMap&libraries=drawing"

Clipping with closed paths and trying to get open paths in the solution using the Clipper library with c#

南楼画角 提交于 2019-12-13 05:24:56
问题 I am using the c# version of Clipper. I would like to clip a closed subj path with a closed clip path, but have the result be multiple open lines. For example, slicing say a star shape into two parts with a long rectangle, but what is left of the two sides of the subj shape is two open lines. In this clipping question, Angus said that the lines to be clipped must be open in order for the results to be open. Is there a way to do the clipping operation with two closed paths? As a workaround, I

Scaling a set of polygons to monitor resolution in WPF

心不动则不痛 提交于 2019-12-13 03:37:11
问题 I have a non-DPI aware WPF application where I want to draw a set of polygons in a borderless window to fit exactly on a monitor. I have an algorithm in place to scale and draw my polygons to any given resolution. In my setup I have a 4K and a FullHD monitor next to each other. My 4K monitor has its scale set to 150% and the FullHD monitor is set to 100%. For the 4K monitor, this means that if I set a windows width and height to 3840x2160, the actual rendered resolution is 2560x1440. Now if I

poly2nb function takes too much time to be computed

半腔热情 提交于 2019-12-13 03:14:18
问题 I have a data frame that have information about crimes (variable x), and latitude and longitude of where that crime happened. I have a shape file with the districts from são paulo city. That is df: latitude longitude n_homdol 1 -23.6 -46.6 1 2 -23.6 -46.6 1 3 -23.6 -46.6 1 4 -23.6 -46.6 1 5 -23.6 -46.6 1 6 -23.6 -46.6 1 And a shape file for the districts of são paulo,sp.dist.sf : geometry NOME_DIST 1 POLYGON ((352436.9 7394174,... JOSE BONIFACIO 2 POLYGON ((320696.6 7383620,... JD SAO LUIS 3

Mapstraction - draw polygon dynamically

喜夏-厌秋 提交于 2019-12-13 01:43:41
问题 In Mapstraction map need to draw a polygon which is editable. So i have tried a example. But polygon is editable mode while it's calling function href="javascript:mapstraction.activateEdition();" in example. I have tried to do that. Didn't get succeed. How do i create polygon which user can edit it and also is this possible to keep only 10 vertices polygon. JS Code var polyPoint; var polyPoints = [] //Adding polygon to map polyPoint = new mxn.LatLonPoint(17.447612 , 78.223686) polyPoints.push

Custom TileProvider with Polygon in Android maps

老子叫甜甜 提交于 2019-12-13 00:55:39
问题 I'm having problems drawing a polygon on Android map. The problem is that I have TileOverlays so the polygon is kinda under the overlays. I'm drawing a polygon on GoogleMap like this: map.addPolygon(new PolygonOptions().add(points).strokeColor(Color.RED).strokeWidth(3f)); map.animateCamera(CameraUpdateFactory.newLatLngZoom(points[0], 18)); I can see the polygon before the tiles are starting to load but then it's gone. I would like to achieve that the polygon is drawn over the TileProvider. I

What's the best way to do collision detection?

妖精的绣舞 提交于 2019-12-13 00:52:22
问题 I have a need to define a polygon that would be the "legal" area, and allow a user to move a rectangle around within that polygon, preventing them from moving the rectangle anywhere where its points venture outside the polygon. The polygon is a fixed shape, so, I was thinking it may be easiest to import a PNG of that shape and pull the points in that way, somehow? But I'm still at a loss as to the math involved in checking the coordinates of the rectangle as the user drags it, and testing at

How to know IF a line segment intersects a triangle in 3d space?

妖精的绣舞 提交于 2019-12-12 23:58:21
问题 I have a triangle defined by 3 points in 3d space. I also have a line segment defined by 2 points in 3d space. I want to know if they intersect. I don't really need to know the point of intersection. I don't know any calculus but I know some trig. I know some about matrices but I understand vectors well (3d vectors specifically). Please keep it simple. Can you walk me through the example problem: triangle: a: -4, 3, 0 b: 4, 3, 0 c: -3, -5, 4 line segment: d: 1, -2, 0 e: -2, 6, 2 EDIT: I am