Reverse geocoding what my opposite position - geocoding

What is my opposite position if my lat is
35.3426120
Long 119.0191580
I have not been able to figure it out

There are two concepts to understand here:
Reverse Geocoding: Which is determining a readable location (eg. Street name) based on the latitude and longitude. In your case somewhere in China
Opposite Position: (aka Antipodes) Is best understood that if you were to dig a straight tunnel through the center of the earth from your current position, where will you end up?
Right so given these two things your answer in this case just west of Buenos Aires.
There are many ways to calculate this with different types of efficiency. You can start by looking at "Rotating Calipers".

Related

Have distance from A to B, C, D - How to get latitude and longitude?

I am not a geographer or the like, so please excuse if I should know better. But my question is: Is it possible to get the latitude and longitude of certain places from distance data?
More precisely, I have the great-circle distance in kilometers from various places to Berlin. Can I somehow decompose this distance data into latitude and longitude?
(FYI I am an economic historian and I work with the software package Stata.)
Yep, but the answer depends on how accurate you want to be.
Quick and easy, but not exact: just assume the earth is a sphere, treat the lat/lon as spherical coordinates (using a fixed 6373km radius), perform the translation using normal 3D euclidean geometry techniques, and convert back to lat/lon at the end. A good summary of the calculations necessary is here, but in summary:
Oh dear, no Latex on this site! Screenshots from the math subsite is best I could do sorry.
If you already have arc length, then rearrange the equation to solve for your unknown. You'll also need to know the angle of your arc to solve for two unknowns, lat and long.
If you need to be exact, you'll need to take into account the non-spherical Earth. That means the length in meters of a degree latitude depends on the latitude.
As described here:
Work with those equations and perhaps ask another more specific question if you get stuck. This current site is best if you have a programming question and the https://math.stackexchange.com site is best if you have a maths question.

How to maintain city road data? (What data structure should I use)

(Sorry my English is not good, but I will try to phrase it clearly)
For example, I've got road data in a form like this:
Latitude Longitude
RoadA(consists of 2 dots)
31.263319 121.5555711
31.2619722 121.5564754
RoadB(consists of 3 dots)
31.2619722 121.5564754
31.2611567 121.557023
31.2610903 121.557088
As you can see, each road consists of several (2~x) dots. The road may be a curve and need many dots to describe it. Between two dots they are connected by a straight line.
Once I have read in all the road data, I will read in a set of dots, my task here is that once a new dot is given, I need to find out if it is on any of the roads. If not, I need to draw a perpendicular towards the nearest road and find out the coordinate of the pedal foot(the nearest point on road).
The amount of query is huge, so I need the speed to be as fast as possible.What kind of data structure should I use?
There are some Spatial Partitioning methods in Game Development and theory.
Maybe you should use one of them.
link
You should partition your locations in Binary,Quad,Oct, ... trees.
I think the best way, is to use a map of Pairs.

Finding the Distance Between Two Lines that represent GPS routes (MATLAB, Java, C++, or Python)

I have been researching and trying to figure this one out to no avail. I have found many ways not to solve this...
The gist of the problem: I am looking for a method to calculate the deviance from an original path traveled by way of GPS coordinates. I have multiple csv files that contain latitude, longitude, and UTC time. I have created KML files from this information for a visual viewing of the deviance and now would like to put a value on this deviation. I ahve chosen a route as a reference and would like to measure the other routes against the reference route. There are multiple routes each having it's own reference route, each of which has many runs. No two runs are the same, and some of the routes deviate more than the next. I cannot use time, only lat and lon since the runs were completed over many weeks of data collection.
What I have tried thus far:
Haversine and Equirectangular formulas (looping through and measuring point to point).
Outcome: The coordinates only line up for a short period of time and the difference in the number of points varies greatly.
Area under each curve: was going to find the difference of the two routes by this method.
Outcome: Really unsure how to proceed, nor find equations suitable for this calculation.
There were a couple more feeble attempts, but have been working on this for a few weeks now, with not much to show for and still unsure on how to proceed.
Any help or ideas would be greatly appreciated.
Possible solution 1: Instead of calculating the "sideways" deviation between the two routes, just compare the respective arc lengths (Matlab: arclength).
Possible solution 2: To compare two routes, each going from the same start A to the same end point B: Draw a straight line between A and B, place a number of equidistant points along AB, and then average the perpendicular distance from these points on AB to the paths you want to compare. The absolute difference between the cumulative deviations from the straight-line reference is your deviation.
Possible solution 3: Calculate the arc length of each route. Place a number of equidistant points along each route. Average the distance between these points.
Both solution 2 and 3 will depend on the number of points you place, but with a higher number of points, the average deviation will converge. Note that these solutions are both related to calculating the area under each curve.

How to determine sunset/sunrise including terrain shadows.

In Google Earth you can use the "Sunlight" layer to view shadows cast by the terrain at any given DateTime: http://i.stack.imgur.com/YFGMj.png
However, I have not been able to find any way to access the sunlight/luminosity/shadow/etc values from the API.
I'm looking for a way to supply Lat, Long and DateTime to determine if an area is in sunlight (taking terrain shadows in to account, there are countless services that will provide simple Sunrise and Sunset times, but these do not consider terrain). This can be done manually with Google Earth, but I'm looking for a programatic method.
Thanks for any thoughts, ideas, leads...
I realise that this is an old question, but it surfaced in a google search I just did, and I liked the focus.
Since you're looking for a programmatic way of determining if a point on earth given by a longitude and latitude tuple is exposed to sun at a given time, I can't help you right now. However, I'm in a position to be able to set up such an API quite easily if we see that this is a feature that many people need. At suncurves.com we calculate sunrise and sunset times accounting for terrain. The solution we've set up so far is a web interface where a user can search for an address or drag and drop the icon on a map to get sunrise and sunset times through the year for that exact spot accounting for terrain. We want to create an API to our data, but we do not have a clear specification of the scope of this API yet. What you ask for requires that we need to:
Calculate the apparent horizon from the viewing point of the
longitude and latitude. This means scanning the terrain data in a
search radius of 30-50 km around your point.
Calculate the sun's position at the specified time.
Calculate the sun's position at the specified time. Determine if the
sun is under or over the horizon as given by the terrain surrounding
your point accounting for atmospheric refraction.
Here's an example from Chamonix, France where the common flat terrain versions of sunrise, sunset times are pretty worthless.
http://suncurves.com/v/7/
I am not sure about determining whether an AOI in in the sun or shade at a certain time, however you can set the SUN to be on or off in the API by using
GESun.setVisibility
Edit:
Using the GE-plugin, create a LookAt with your desired AOI lat/long where the view is directly above looking straight down. Depending on the size of you actual AOI I would keep the view as low to the ground as possible.
Then capture a screenshot/image - I do not think this is possible through GE (if anyone knows a way I would like to find out), so maybe use javascript to take it - I found this Q on SO that provides some insight.
Take a screenshot with GESun.setVisibility set ON and then another with it OFF
Compare the two images for darkness/lightness or something and determine if your AOI is in the shade or not. You might find it better to surround your AOI in a Polygon of some sort in order to help your program distinguish it from the rest of the image - depending on the height the LookAt was taken from etc etc....
I do not have any ideas on how to compare the images, but yet again another search on SO resulted in this (I would presume finding the values of COLOR_BLACK in PHP ImageMagick) and this (Color Buckets idea).
Depending on your method of choice, it might help to alter your images to black/white before doing the comparing.

Finding the spread of each cluster from Kmeans

I'm trying to detect how well an input vector fits a given cluster centre. I can find the best match quite easily (the centre with the minimum euclidean distance to the input vector is the best), however, I now need to work how good a match that is.
To do this I need to find the spread (standard deviation?) of the vectors which build up the centroid, then see if the distance from my input vector to the centre is less than the spread. If it's more than the spread than I should be able to say that I have no clusters to fit it (given that the best doesn't fit the input vector well).
I'm not sure how to find the spread per cluster. I have all the centre vectors, and all the training vectors are labelled with their closest cluster, I just can't quite fathom exactly what I need to do to get the spread.
I hope that's clear? If not I'll try to reword it!
TIA
Ian
Use the distance function and calculate the distance from your center point to each labeled point, then figure out the mean of those distances. That should give you the standard deviation.
If you switch to using a different algorithm, such as Mixture of Gaussians, you get the spread (e.g., std. deviation) as part of the model (clustering result).
http://home.deib.polimi.it/matteucc/Clustering/tutorial_html/mixture.html
http://en.wikipedia.org/wiki/Mixture_model