point

Test if point is in some rectangle

笑着哭i 提交于 2019-11-30 09:03:33
I have a large collection of rectangles, all of the same size. I am generating random points that should not fall in these rectangles, so what I wish to do is test if the generated point lies in one of the rectangles, and if it does, generate a new point. Using R-trees seem to work, but they are really meant for rectangles and not points. I could use a modified version of a R-tree algorithm which works with points too, but I'd rather not reinvent the wheel, if there is already some better solution. I'm not very familiar with data-structures, so maybe there already exists some structure that

Making a Point Class in Python

瘦欲@ 提交于 2019-11-30 07:50:47
问题 I am trying to create a class in python titled "Point." I am trying to create a point on a coordinate plane x and y and track them. As well as find the distance between the points. I have to use functions and methods. I have started and here is my code. I am just not sure how to use it when I go to execute the program. Any help will be appreciated. EDIT: Updated Code import math class Point(object): '''Creates a point on a coordinate plane with values x and y.''' COUNT = 0 def __init__(self,

Find the distance between two points in MYSQL. (using the Point Datatype)

纵饮孤独 提交于 2019-11-30 04:50:44
问题 Suppose I have a 2 column table like this: | user_id | int(11) | NO | UNI | NULL | | | utm | point | NO | MUL | NULL | | As you can see, it's very simple. utm is a Point data-type. I insert it like this: INSERT INTO mytable(user_id, utm) VALUES(1, PointFromWKB(point(50, 50))); Then, I create a Spatial index. ALTER TABLE mytable ...add spatial index on(utm) or something. (forgot) Alright, everything is good. Now , I want to select * where distance < 99999. But it doesn't work! //This is

Delphi array initialization

房东的猫 提交于 2019-11-30 00:42:42
问题 I currently have this, and it sucks: type TpointArray = array [0..3] of Tpoint; class function rotationTable.offsets(pType, rotState, dir: integer): TpointArray; begin Result[0] := point(1, 1); Result[1] := point(1, 2); Result[2] := point(1, 1); Result[3] := point(1, 1); end; but instead, i want to do something like this: class function rotationTable.offsets(pType, rotState, dir: integer): TpointArray; begin Result := [Point(1,1), Point(1,2), Point(1,1), Point(1,1)]; end; However, on

Convert a shapefile from polygons to points? [closed]

瘦欲@ 提交于 2019-11-29 23:27:24
问题 I have a non-overlapping polygon-based shapefile (.shp) with a large spatial extent and many dozens of associated attributes. The shapefile is projected in UTMs. I would like to convert the polygons to points spaced out in a 30-m resolution grid, in which each point would retain the attributes of the polygon it is located within. Output would simply be a table of the points: X, Y, attribute1, attribute2, attribute 3,etc... I would ideally like to do this operation in R, or (less ideally) some

Find cells in array that are crossed by a given line segment

别说谁变了你拦得住时间么 提交于 2019-11-29 18:02:19
I have got a 2D array of cells with size 10x10, and many points that are pairs of floating point values, like: (1.6, 1.54), (4.53, 3.23). The pairs (x,y) are such that x<10 and y<10 Each cell takes points whose coordinates have the same integer part as the cell coordinates. So arr[3][7] will take points with x={3...3.99(9)} and y={7... 7.99(9)}, for example (3.5, 7.1) or (3.2, 7.6). Similarly (1.6, 1.54) is in arr[1][1] , (4.53, 3.23) is in arr[4][3], etc. Each point has got a designated place in the array that is easy to find, because I just have to cast x and y to int to get rid of the

Points moving along a curve within MATLAB

谁说我不能喝 提交于 2019-11-29 14:14:18
I have managed to edit a piece of code that was given to me in order to show a point moving along a curve. I am trying to find a way to edit this in order to create two independent points moving along this curve or to create a second figure that shows another point moving along a graph. The main point is that the points need to be independent of one another so that an algorithm can be applied to them. I currently have the following code which gives a single point moving along the curve: %# control animation speed DELAY = 0.01; numPoints = 600; %# create data x = linspace(0,1,numPoints); f = 5;

Lon/Lat Order when using spatial POINT type with MySQL

无人久伴 提交于 2019-11-29 13:30:46
What is the correct order when setting a POINT in MySQL? Even the answers in SO questions differ on this: Moving lat/lon text columns into a 'point' type column Is it POINT(lat lon) or POINT(lon lat) As far, as i see it, it should be the first version (lat lon) as the POINT takes as params x and y, but i was not able to find an definite evidence. mons droid as one can see here https://stackoverflow.com/a/5757054/1393681 the order is (lon lat). lon is basicly the y axis and lat the x if i look at my globe, but the lon's are traveling along the x axis and the lat's along the y axis so i think

Determine if Shapely point is within a LineString/MultiLineString

谁说我不能喝 提交于 2019-11-29 11:02:49
I am trying to use Shapely's within function to do a 'spatial join' of a LineString and a Point file (FYI, the point file was generated using the interpolate function on the LineString ). Problem is - nothing is being returned. # this condition is never satisfied if point.within(line): # here I write stuff to a file where: point = POINT (-9763788.9782693591000000 5488878.3678984242000000) line = LINESTRING (-9765787.998118492 5488940.974948905, -9748582.801636808 5488402.127570709) What am I missing? There are floating point precision errors when finding a point on a line. Use the distance

Making a Point Class in Python

霸气de小男生 提交于 2019-11-29 05:21:11
I am trying to create a class in python titled "Point." I am trying to create a point on a coordinate plane x and y and track them. As well as find the distance between the points. I have to use functions and methods. I have started and here is my code. I am just not sure how to use it when I go to execute the program. Any help will be appreciated. EDIT: Updated Code import math class Point(object): '''Creates a point on a coordinate plane with values x and y.''' COUNT = 0 def __init__(self, x, y): '''Defines x and y variables''' self.X = x self.Y = y def move(self, dx, dy): '''Determines