coordinates

How to convert a set of point coordinates from a concave hull into a polygon in R?

情到浓时终转凉″ 提交于 2019-12-23 19:14:53
问题 I have an alphahull::ashape() result that I need to convert with spatstat::owin() for subsequent spatial analyses. Is there an elegant solution how to order the points from the concave hull and convert the shape to an owin object or any Spatial* object? With ordered points in a hypothetical matrix coords the polygon is defined as: geo.owin=try(owin(poly=list(x=coords[,1],y=coords[,2])),silent=T) if(class(geo.owin)=="try-error") geo.owin=owin(poly=list(x=rev(coords[,1]),y=rev(coords[,2])))

Can I limit users to a specific range and zoom level on Google Maps?

爱⌒轻易说出口 提交于 2019-12-23 16:59:45
问题 I'm implementing a Google Map on a web-page. For the purpose of this project, I want to limit how far users can drag the map, so that they can only view a certain area that falls within two co-ordinates (one specifies north-west, the other, south-east, if you get my meaning). What's the best way to implement this using the Google Maps API? Is there a method I can call that will do this automatically? 回答1: This method does what you want: http://econym.org.uk/gmap/range.htm 来源: https:/

How to create 10 random x, y coordinates in a grid using Python

帅比萌擦擦* 提交于 2019-12-23 12:50:59
问题 I need to create a 8x8 grid and distribute 10 coins in random positions on the grid. The problem I am facing is that the randint function will sometimes generate the same random co-ordinates and therefore only 9 or 8 coins are generated and placed on the grid. How can I make sure this doesn't happen? Cheers :) This is my code so far: from random import randint grid = [] #Create a 8x8 grid for row in range(8): grid.append([]) for col in range(8): grid[row].append("0") #create 10 random

Graphics2D: Should I use the int or float versions?

我们两清 提交于 2019-12-23 12:41:59
问题 Some of the Graphics2D methods, such as drawString , have versions that take coordinates as int or float . Are there any reasons to choose one over the other? Likewise, should I use the newer Shape classes, such as Rectangle2D (which use floating-point coordinates), or use Rectangle (which defines coordinates as int s)? 回答1: I see int and float - drawString(AttributedCharacterIterator iterator, float x, float y) Renders the text of the specified iterator, using the Graphics2D context's

Computing latitude longitude center point of a Polygon in PHP

眉间皱痕 提交于 2019-12-23 10:25:56
问题 I have a set of points (stored as lat/lon) for a polygon, I want to compute the lat/lon center point of the polygon in PHP. Basically to do the same thing as the getCenter() function in Google Maps LatLngBounds. Any ideas on how I can achieve this? 回答1: What you are looking for is the centroid of the polygon - which is pretty easy to compute. If you are using latitude/longitude the matter is complicated by the fact the the polygon is actually on the surface of a sphere (ellipsoid). As an

Computing latitude longitude center point of a Polygon in PHP

强颜欢笑 提交于 2019-12-23 10:25:19
问题 I have a set of points (stored as lat/lon) for a polygon, I want to compute the lat/lon center point of the polygon in PHP. Basically to do the same thing as the getCenter() function in Google Maps LatLngBounds. Any ideas on how I can achieve this? 回答1: What you are looking for is the centroid of the polygon - which is pretty easy to compute. If you are using latitude/longitude the matter is complicated by the fact the the polygon is actually on the surface of a sphere (ellipsoid). As an

Find perpendicular line using points on that line

六眼飞鱼酱① 提交于 2019-12-23 06:11:06
问题 I have a line (P1, P2), and a point on that line (midpoint). What equation can I used to find the perpendicular line of line (P1, P2), that passes through midpoint. The point labelled with a '?' is unknown. I do not wish to use angles, only the 3 points given (P1, P2, midpoint). The line P1, P2 can be of any orientation/angle. Thanks in advance. 回答1: Let define vector D = P2 - P1 (dx=x2-x1, dy = y2-y1) and middle point mx = (x2+x1)/2 my = (y2+y1)/2 Perpendicular to D vector PD = (-dy, dx)

Google Maps' marker moves when zooming

和自甴很熟 提交于 2019-12-23 05:17:11
问题 I've added a mark to my map but when I zoom in it moves to the left (at maximum zoom in it marks the right place) and when I zoom out it moves to the right (at maximum zoom out it marks like 3000Km from the right place). Here's the class that draws the marker before the onCreate (the image is 62px w x 70px h): class MapOverlay extends com.google.android.maps.Overlay { @Override public boolean draw(Canvas canvas, MapView map, boolean shadow, long when) { super.draw(canvas, map, shadow); Point

Calculating distance between 400 cities and optimizing MySQL for it?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 05:15:21
问题 I've got a database of around 400 cities. User selects a city in which he lives, and enters the distance which he is willing to travel (for example, 40kilometers). The city_id is stored into search table, with some other irrelevant information. When user submits the form, he's redirected to results page, on which all results from search table are shown, that meet the criteria, but I want to order them by the distance between city form user's city and the result city, and order the results by

How to distinct two markers placed at the same coordinates in Nokia Here map

泄露秘密 提交于 2019-12-23 04:52:50
问题 I have two markers placed at the same coordinates in a Nokia Here map. The problem is I can access only at one marker. The other is below the first one. Is there any options or something else to manage this case, in order to have access to all markers placed at the same coordinates ? 回答1: The only way to ensure that all markers are separately visible is to put the overlapping markers at slightly different locations. The best effect I have found is to use the clustering functionality down to