Grouping points by certain rules - gis

I need to group point data, that I plotted out.
I have a points with the attributes "A", "Slots#", "w".
I need to Group within "A" the "W" in to groups "slots#" that are within 1000 meters of each other.
Im not sure how to do this, any help would be appreciated.

Related

Matching GPS coordinates

I am looking for a tool to match GPS coordinates. Attached is a sheet with a list of GPS coordinates.
https://docs.google.com/spreadsheets/d/1pCVlq7BEUBQyST0iRoPcgp_XUhUyOYjAuPQ3mfR5ehU/edit#gid=0
I tried array but I cannot make 1 cell subtract from a column and even if I do it is taking a very long method.
Do you have any suggestion of what I can use?
I ideal situation I’m hoping for is that it checks the list of coordinates and highlight the coordinates that exist more than once, say within 300meters.
I use this formula to calculate distance between 2 points
= 111*SQRT((X1-X2)^2+(Y1-Y2)^2)
Each change in degree of GPS coordinate, corresponds to 111km on geographical scale approx.
Solution
You can check the coordinate points that are closer than a specific distance by creating, in another sheet, a matrix of distances between all the points and by using conditional formatting to highlight the pair of points that are closer than a specific distance.
Steps to achieve this:
Create a new sheet in your Spreadsheet.
In the first cell insert the following formula:
=ARRAYFORMULA(SQRT(POW(INDIRECT("Sheet1!$B"&(COLUMN(B2)))-Sheet1!$B2:$B340,2) + POW(INDIRECT("Sheet1!$C"&(COLUMN(B2)))-Sheet1!$C2:$C340,2)))
Formula explanation : This formula calculates the euclidean distance between two coordinate points. I have used ARRAY FORMULA to automatically calculate the distance between the first point with the rest of the coordinates of your GPS signal. Note that indirect is used so that you can propagate this formula to the rest of the columns. In this case I am testing with 340 coordinate points but you can increase this as you want.
Select the cell where you wrote the formula in and drag it through the columns until you reach your total number of elements. (You can easily check this when the 0s diagonal reaches the last row of values).
Select your whole range (matrix) and head over to Format -> Conditional Formatting and then in the UI in Less or equal than choose the distance you wish to put as the limit.
In this way you will have this distance matrix telling you which intersection points are closer than a specific distance. This is an example image of how it would look like (for distances smaller than 0.4):
Resources used :
ARRAYFORUMLA, POW, INDIRECT, Conditional Formatting

Mysql: find polygon within certain radius

In my database I have polygons stored. Now I need to search all the polygons that are within a certain radius.
Even if the polygon is only a small part inside the region, then it should be included inside the results (so once there is a minimal match, there is a match).
What is the best way to do this? I have been thinking about creating another polygon and search everything that intersects this, but don't know if this is a valid method?
Yes, I think it is the best approach. You can create a polygon using ST_BUFFER and then you can use ST_INTERSECT to find if polygons will intersect your polygon.
May be you can also do it using ST_DISTANCE. It will calculate minimum distance of a point from polygon.
Select ST_DISTANCE(polygons,POINT(x, y)) as distance, polygon_id from your_polygon_table WHERE distance <= 10
I struggled with the same issue and came up with the following that works well.
select this.poly, other.poly
from table this, table other
where this.name = 'name of subject polygon'
and ST_Distance(ST_Centroid(this.polygon),ST_Centroid(other.polygon)) < 'desired distance';
This will work with the initial point is in the same table as the other polygons. If you have a fixed initial point you can simplify the query as follows:
select poly from table
where ST_Distance('26.36, -81.07',ST_Centroid(other.polygon)) < 'desired distance';

google map placing locations with some distance

I'm new to ROR and Google Maps. I need to place some markers from locations in Google Maps (having latitudes and longitudes in a database).
The problem is that I need to select some points with some random distance.
In short, I need to select the location and place it in a map, which must have 100 m distance with each and every points.
If the location is within 100 m range with any other points, it can be neglected. I need to place 10 points from database.
Is there any method?
Assuming that you are needing to find points from your database that are at least 100 meters away from all the other points in the database:
This is a fairly simple problem. It can be visualized as an nxn matrix, with the point set as the rows and columns. In Python, comparing all the distances would look like:
selected = []
for pt1 in pts:
inRange = True
for pt2 in pts:
if pt1.distanceTo(pt2) < 100:
inRange = False
break
if inRange:
selected.append(pt1)
This function iterates through the whole list of points. For each point, it checks the distance from the current point to all the other points. If all the other points are outside 100 meters, it adds the point to an array.
For the distance formula, please see the haversine formula here in code form.
Since you did not specify a language in your question, I will let you translate this into whatever language you need. This is just pseudocode, since not enough details were provided to answer your question with actual code.
Also, if I misunderstood your question, you can adapt this algorithm in some way. It is just to provide some ideas.

Lime Survey Equation

In Lime Survey, I want to get a sum total of subquestion values in an array question.
I used the following:
{(A1_sq1.value+A1_sq2.value+A1_sq3.value+A1_sq4.value+A1_sq5.value+A1_sq6.value+A1_sq7.value+A1_sq8.value+A1_sq9.value+A1_sq10.value+A1_sq11.value)}
If I click the array radio buttons in order, I get the correct total. But if I check on them out of order, I get each individual response listed in sequence (i.e. no sum).
So clicking in order I might get '18', whereas, if I did the whole set backwards, I'd get '12221222112'
Is this a bug, or am I writing the equation wrong?
If the question code for the array is "A1", this will return the total value for the array:
{sum(that.A1.value)}

Move along polyline based on time

I am busy with building a kind of 'track' player for GPS Tracks.
I have in my database all the positions of a certain track (latitude, longitude, altitude, time).
I am able to display the whole track on a map and move the marker along that track (see http://89.188.9.68/nl/gebruikers/track/trackid/101/#.T5AbauxNs1Y). At the left you have somewher 'starten!!!!'. If you hit that he will move along the track but based on distance.
My goal is that I could move based on time. Final goal is that I have 2 markers, 2 tracks and that I could play it and see the difference between the 2 markers. If i use distance it will be for both the same, but I would see where person 1 (track 1) was and where person 2 was at that moment.
Anyone any idea how i could make this work? Or any idea how this is possible? One of my ideas is that I ask for every movement the position of a certain person (asking it to the database), but isn't that too heavy?
Currently I use v3, but if you think v2 is better for this, i could always switch ;)
Thanks!
I can only think of setInterval actually counting time ticks, as shown here
http://jsfiddle.net/KSp4j/
You mentioned querying a database, yet in your example all the points are in the source. What I show needs the data already loaded in the HTML file. I use a format:
[
[time 1st pt. arrived, lat, lng]
[time 2nd pt. arrived, lat, lng]
[time 3rd pt. arrived, lat, lng]
...
]
and check the elapsed time with array's time.