I have a dataset in which I have a column of geographical points, and I want to calculate the total distance of the path that these geographical points cover, so that I can add it to the details of the 'route'.
What's the cleanest and simplest way to do this?
My first thought was to create another column, which is the same as this one, except shifted by a single index value, and then to use DISTANCE, and then to SUM over this, however I'm new to Tableau and I'm not even sure if something like this is possible? I'm sure there's a more elegant way to do this.
Cheers.
Related
I have lots of places data(tourist attractions) stored in database. Every place has coordination info, such as latitude and longitude. When I randomly choose a route (for example: from somewhere in New York to somewhere in Boston), how can I find the 10 closest places along the route? I guess it's relative to geography algorithms. I'm trying to find a way to minimize the total calculation time and save cell phone battery. Thank you for any suggestions!
One way would be:
Consider the map to be a grid eg of 1km x1km boxes
plot the route and see which of these grid boxes it enters.
for each box, find the places/landmarks in the box which is not computationally expensive if you search your database my min/max longitude/latidtude position where the grid box starts/ends
To show the top N from these, you can calculate the shortest distance for these subset of places rather than the whole dataset.
I have a list of latitude and longitude values in a database. Based on a user’s location I need to extract the closest location from the database based on walking distances. For this purpose, I need to first get all values from the database into an array and then calculate WALKING distances to each and then return the lat/long of the shortest distance.
Note: I have no problem extracting the database values. I need help with the calculation of walking distances between 2 points.
I have so far found threads here which either show straight line distances. Is there any way to get walking distances between 2 points? If so, I would appreciate if you could point me in the right direction (link/previous question) or provide some guidance on what classes or functions to use.
You can get the distance in meter using the
CLLocationDistance distance = [locationOne distanceFromLocation:locationTwo];
you can acoordingly convert it into CentiMeter or Kilometer, this may serve your purpose
I have a large data set of regions , each of which is defined by a longitude, latitude and a given radius. I have a location point with a a latitude and longitude and I need to determine which of the regions contains my point.
Currently I am using brute force : I compute the distance between the target point and each region's center longitude and latitude ; if the distance is less than the radius of the region, I include the region in in my result.
Obviously this solution is not tenable.
Can GeoHash be used to formulate a solution ?
Edit : The business problem is given a set of cell phone with known ranges and a fixed set of available locations owned by a real estate holding, where is the place for a signal repeater. There are other considerations of course besides location and distance. Otherwise someone will have drive around the country with a signal detection kit -- not optimal . Not a homework question. I have Comp Sci background but GIS is new to me and I am willing to learn.
Edit : I will continue using brute force across several ec2 instances. Not the most optimum solution but it works. Thank you all for proposed solutions but unfortunately given the time and knowledge constraints and vagueness of the methodology, I am not going to be able to try them out.
The usual approach is to use a spatial index like quad tree or kd tree.
To this index you add the rectangular bounds of all circles to build up the index.
Uisng the quad tree:
Query the index which objects overlap a quad node at given position. The result will be some circles , these you check as you described.
quad trees don't like the deletion of elements.
I'm developing an iOS application that needs to determine the probability that a user is following a given path.
If they are not following the path, I'd like to give them the option to recalculate.
This should be a relatively simple algorithm, for inputs I have a location (x,y) and n paths (two x,y points).
What is the best way to do this?
You might look at Dijkstra's algorithm to find shortest distance between two points? What I think is you should always feed the current location of vehicle as it will show the recalculated value if taken a wrong turn and show it in graph. Hope it helps.
We are purchasing a database of zip codes and their corresponding Lat/Long. I want to store cities in a separate table with a lat/long point representing the center of the city. Can I calculate that based on taking all of the zips that belong to that city, getting the min/max points for each direction, and taking the center point of the resulting rectangle?
Is there a more accurate method? I want to avoid purchasing another DB. We haven't purchased the full DB yet so I can't just try it and compare the results to Google Maps.
Well actually ZIP codes do not always encompass cities. Zip codes are arbitrary regions used to defined postal addresses.
Edit: Not always your assumption that the sum of all ZIP Codes will correspond to the city boundary or will retrieve you the correct centroid.
Your best bet is to get a countys table with spatial data in it.
In PostGIS a simple ST_Centroid(GeometryField) would suffice to get you the centroid of a polygon. That works out for any type of polygons.
If you are in the US, probably exists a public county/cities/states dataset availuable on the internet. Consider GIS tools for doing this work.
Would that be very helpful? That might give you something that approximates the geographic center, but normally when you talk about the center of the city, you are talking about the town square, or the commercial center, or the historical center.
Go to google maps for example. If you search for New York, it will take you directly to Times Square. Isn't that really what you expect if you search for the center of that City.
Well, the center of a city is impossible to calculate exactly, as there are probably as many views on what the center is as there are people...
Instead of using just the min/max points of the zip code areas, you could get the average of all positions, that would give you a more weighted position.
If you have an approximate number of people for each zip code you could use that as weight for the points, that would give you a "gravital center" of the population.
City Hall is always used to define the city center, used by the National Transportation and Highways division, all globes and maps.
I would use the average value of the four coordinates of the four borders of the town as the geographical center, using the Google map.